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 页
评论区
写评论还没有评论