Problem set Variables, Shadowing Problem 6. Incorrect Solution.
delta549 opened this issue · comments
delta549 commented
Problem set Variables, Shadowing Problem 6. States:
// Remove a line in the code to make it compile
fn main() {
let mut x: i32 = 1;
x = 7;
// Shadowing and re-binding
let x = x;
x += 3;
let y = 4;
// Shadowing
let y = "I can also be bound to text!";
println!("Success!");
}
However the Solution in the rust-by-practice book states:
6.
fn main() {
let mut x: i32 = 1;
x = 7;
// Shadowing and re-binding
let mut x = x;
x += 3;
let y = 4;
// Shadowing
let y = "I can also be bound to text!";
println!("Success!");
}
I feel this is incorrect as making the variable mutable is not the question:
let mut x = x;
The real solution should be the removal of the:
x+=3;
as the questions asks:
// Remove a line in the code to make it compile
delta549 commented
Thankyou for the Merge! 😄