pull/116/head
unknown 3 years ago
parent 718c89ea91
commit 870c198982

@ -1,7 +1,7 @@
# Functions # 函数(Functions
Here, you'll learn how to write functions and how Rust's compiler can trace things way back. 在本练习,你将学习如何编写一个函数,以及 Rust 的编译器怎样对事物进行追溯way back
## Further information ## 更多信息
- [How Functions Work](https://doc.rust-lang.org/book/ch03-03-how-functions-work.html) - [How Functions Work](https://doc.rust-lang.org/book/ch03-03-how-functions-work.html)

@ -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,8 +1,9 @@
// 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);
} }

@ -78,18 +78,16 @@ name = "functions1"
path = "exercises/functions/functions1.rs" path = "exercises/functions/functions1.rs"
mode = "compile" mode = "compile"
hint = """ hint = """
This main function is calling a function that it expects to exist, but the `call_me`
function doesn't exist. It expects this function to have the name `call_me`.
It expects this function to not take any arguments and not return a value. `main` """
Sounds a lot like `main`, doesn't it?"""
[[exercises]] [[exercises]]
name = "functions2" name = "functions2"
path = "exercises/functions/functions2.rs" path = "exercises/functions/functions2.rs"
mode = "compile" mode = "compile"
hint = """ hint = """
Rust requires that all parts of a function's signature have type annotations, Rust `call_me` `num` """
but `call_me` is missing the type annotation of `num`."""
[[exercises]] [[exercises]]
name = "functions3" name = "functions3"

Loading…
Cancel
Save