< 返回我的博客

hbgjh 发表于 2021-02-23 16:20

fn another_function(x:i32,y:i32)-> i32 { let z=x+y; println!("Hello, runoob!"); println!{"{}", z};

if z < 5 {
    println!("条件为 true");
} else {
    println!("条件为 false");
}

return z;

}

fn max(array: &[i32]) -> i32 { let mut max_index = 0; let mut i = 1; while i < array.len() { if array[i] > array[max_index] { max_index = i; } i += 1; } array[max_index] }

fn fnloop() { let a = [10, 20, 30, 40, 50]; for i in a.iter() { println!("值为 : {}", i); } }

评论区

写评论

还没有评论

1 共 0 条评论, 1 页