fn main() {
let x = 3;
println!("Number {}", x);
x = 5; // don't change this line
println!("Number {}", x);
}
Solution
fn main() {
let mut x = 3; // add the `mut` to make the variable mutable to change it to 5
println!("Number {}", x);
x = 5; // don't change this line
println!("Number {}", x);
}
fn main() {
let number = "T-H-R-E-E"; // don't change this line
println!("Spell a Number : {}", number);
number = 3; // don't rename this variable
println!("Number plus two is : {}", number + 2);
}
Solution
fn main() {
let number = "T-H-R-E-E"; // don't change this line
println!("Spell a Number : {}", number);
// Change `number` to a different scope
{
let number: u8 = 3; // don't rename this variable
println!("Number plus two is : {}", number + 2);
}
}