Update Examples
parent
5a1b018006
commit
8d862ef2bb
@ -673,11 +673,11 @@ fn main() {
|
||||
|
||||
let big_n =
|
||||
if n < 10 && n > -10 {
|
||||
println!(", and is a small number, increase ten-fold");
|
||||
println!(", and is small, × 10");
|
||||
// This expression returns an `i32`.
|
||||
10 * n
|
||||
} else {
|
||||
println!(", and is a big number, halve the number");
|
||||
println!(", and is big, / 2");
|
||||
// So here must return `i32` as well.
|
||||
n / 2
|
||||
// TODO ^ Try inserting a semicolon.
|
||||
@ -703,11 +703,11 @@ fn main
|
||||
//! Note more literate logical operators
|
||||
let big_n =
|
||||
if n < 10 and n > -10
|
||||
println! ", and is a small number, increase ten-fold"
|
||||
println! ", and is small, × 10"
|
||||
// This expression returns an `i32`.
|
||||
10 * n
|
||||
else
|
||||
println! ", and is a big number, halve the number"
|
||||
println! ", and is big, / 2"
|
||||
// So here must return `i32` as well.
|
||||
n / 2
|
||||
// TODO ^ Try inserting a semicolon.
|
||||
@ -716,6 +716,5 @@ fn main
|
||||
//! ^ Husht FTW!
|
||||
|
||||
println! "{} -> {}", n, big_n
|
||||
|
||||
```
|
||||
</td></tr></table>
|
Loading…
Reference in New Issue
Block a user