February 2022
Intermediate to advanced
140 pages
2h 28m
English
| Puzzle 3 | Type Conversion |
| | fn main() { |
| | let x : u64 = 4_294_967_296; |
| | let y = x as u32; |
| | if x == y as u64 { |
| | println!("x equals y."); |
| | } else { |
| | println!("x does not equal y."); |
| | } |
| | } |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
The program will display the following output:
| | x does not equal y. |
Rust’s as keyword is lossy. And when you use it to convert ...
Read now
Unlock full access