mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-02-13 00:16:11 +02:00
Merge pull request #186 from rastringer/patch-1
Speaker notes for 6.5 Functions
This commit is contained in:
commit
790e964ee6
@ -29,3 +29,12 @@ fn fizzbuzz_to(n: u32) { // `-> ()` is normally omitted
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<details>
|
||||
|
||||
* We refer in `main` to a function written below. Neither forward declarations nor headers are necessary.
|
||||
* Declaration parameters are followed by a type (the reverse of some programming languages), then a return type.
|
||||
* The last expression in a function body becomes the return value. Simply omit the `;` at the end of the expression.
|
||||
* Some functions have no return value, and output the 'unit type', `()`. The compiler will infer this if the `-> ()` return type is omitted.
|
||||
|
||||
</details>
|
||||
|
Loading…
x
Reference in New Issue
Block a user