[][src]Function tao_of_rust::ch02::control_flow::if_expr

pub fn if_expr()

if表达式

Basic usage:

fn if_expr() {
    let n = 13;
    let big_n = if n < 10 && n > -10 {
        10 * n
    } else {
        n / 2
    };
    assert_eq!(big_n, 6);
}
if_expr();Run