Puzzle 3: Type Conversion
Let’s try a type-conversion puzzle in Rust.
We'll cover the following...
We'll cover the following...
Guess the output
Before moving on to the explanation, try to guess the output of the following program. Good luck!
Press + to interact
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."); }}
Quiz
Q
What is the output of the code above?
A)
[error] out of range!
B)
x equals y.
C)
x does not equal y.