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)

@ -1,8 +1,9 @@
// functions1.rs
// Make me compile! Execute `rustlings hint functions1` for hints :)
// 让我能够编译!执行 `rustex hint functions1` 获取提示 :)
// I AM NOT DONE
/// 翻译: [mg-chao](https://github.com/mg-chao)
fn main() {
call_me();
}

@ -1,8 +1,9 @@
// functions2.rs
// Make me compile! Execute `rustlings hint functions2` for hints :)
// 让我能够编译!执行 `rustex hint functions2` 获取提示 :)
// I AM NOT DONE
/// 翻译: [mg-chao](https://github.com/mg-chao)
fn main() {
call_me(3);
}

@ -78,18 +78,16 @@ name = "functions1"
path = "exercises/functions/functions1.rs"
mode = "compile"
hint = """
This main function is calling a function that it expects to exist, but the
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.
Sounds a lot like `main`, doesn't it?"""
`call_me`
`main` """
[[exercises]]
name = "functions2"
path = "exercises/functions/functions2.rs"
mode = "compile"
hint = """
Rust requires that all parts of a function's signature have type annotations,
but `call_me` is missing the type annotation of `num`."""
Rust `call_me` `num` """
[[exercises]]
name = "functions3"

Loading…
Cancel
Save