Update Examples

Glen Whitney 2024-08-25 03:28:49 +00:00
parent 5a1b018006
commit 8d862ef2bb

@ -673,11 +673,11 @@ fn main() {
let big_n = let big_n =
if n < 10 && n > -10 { if n < 10 && n > -10 {
println!(", and is a small number, increase ten-fold"); println!(", and is small, × 10");
// This expression returns an `i32`. // This expression returns an `i32`.
10 * n 10 * n
} else { } else {
println!(", and is a big number, halve the number"); println!(", and is big, / 2");
// So here must return `i32` as well. // So here must return `i32` as well.
n / 2 n / 2
// TODO ^ Try inserting a semicolon. // TODO ^ Try inserting a semicolon.
@ -703,11 +703,11 @@ fn main
//! Note more literate logical operators //! Note more literate logical operators
let big_n = let big_n =
if n < 10 and n > -10 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`. // This expression returns an `i32`.
10 * n 10 * n
else else
println! ", and is a big number, halve the number" println! ", and is big, / 2"
// So here must return `i32` as well. // So here must return `i32` as well.
n / 2 n / 2
// TODO ^ Try inserting a semicolon. // TODO ^ Try inserting a semicolon.
@ -716,6 +716,5 @@ fn main
//! ^ Husht FTW! //! ^ Husht FTW!
println! "{} -> {}", n, big_n println! "{} -> {}", n, big_n
``` ```
</td></tr></table> </td></tr></table>