函数的三种类型 有参数有返回值 有参数无返回值 无参数无返回值 123456789101112131415161718192021222324fn other_fun() { println!("This is a function"); }fn other_fun1 (a: i32, b: u32) { println!("a = {} , b = {}" , a,b); }fn other_fun2 (a :i32 , b: i32 ) -> i32 { let result = a + b; //c语言常用这种写法返回,但是Rust使用下面的写法较多 //return result; result//或者直接使用a+b也可以 }fn main() { other_fun(); let a: i32 = -1; let b: u32 = 20; let c: i32 = 6; other_fun1(a,b); let r: i32 = other_fun2(a,c); println!("r = {} ",r ); }