mirror of https://github.com/sunface/rust-course
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
312 B
15 lines
312 B
3 years ago
|
// functions5.rs
|
||
3 years ago
|
// 让我能够编译!执行 `rustex hint functions5` 获取提示 :)
|
||
3 years ago
|
|
||
|
// I AM NOT DONE
|
||
|
|
||
3 years ago
|
/// 翻译: [mg-chao](https://github.com/mg-chao)
|
||
3 years ago
|
fn main() {
|
||
|
let answer = square(3);
|
||
3 years ago
|
println!("The answer is {}", answer);// 译:"答案是 {}"
|
||
3 years ago
|
}
|
||
|
|
||
|
fn square(num: i32) -> i32 {
|
||
|
num * num;
|
||
|
}
|