mirror of https://github.com/sunface/rust-course
Merge pull request #116 from mg-chao/20220102_functions
[rust-exercise] 翻译 functions 部分pull/126/head
commit
53cce3d999
@ -1,8 +1,9 @@
|
|||||||
// functions1.rs
|
// functions1.rs
|
||||||
// Make me compile! Execute `rustlings hint functions1` for hints :)
|
// 让我能够编译!执行 `rustex hint functions1` 获取提示 :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
/// 翻译: [mg-chao](https://github.com/mg-chao)
|
||||||
fn main() {
|
fn main() {
|
||||||
call_me();
|
call_me();
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
// functions2.rs
|
// functions2.rs
|
||||||
// Make me compile! Execute `rustlings hint functions2` for hints :)
|
// 让我能够编译!执行 `rustex hint functions2` 获取提示 :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
/// 翻译: [mg-chao](https://github.com/mg-chao)
|
||||||
fn main() {
|
fn main() {
|
||||||
call_me(3);
|
call_me(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call_me(num:) {
|
fn call_me(num:) {
|
||||||
for i in 0..num {
|
for i in 0..num {
|
||||||
println!("Ring! Call number {}", i + 1);
|
println!("Ring! Call number {}", i + 1);// 译:"叮!呼叫号码 {}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue