Puzzle 18 | Mutable Immutables |
| fn main() { |
| let life_the_universe = &mut 41; |
| *life_the_universe += 1; |
| println!("Life, the Universe and Everything: {}", life_the_universe); |
| } |
Guess the Output | |
---|---|
Try to guess what the output is before moving to the next page. |
The program will display the following output:
| Life, the Universe and Everything: 42 |
Discussion
The surprising part of this teaser is that the life_the_universe ...
Get Rust Brain Teasers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.