Cannot change variable type
examples/variables/cannot-change-type/src/main.rs
fn main() { let mut answer = "What is the answer"; println!("{answer}"); answer = 42; println!("{answer}"); }
error: expected `;`, found `answer` --> src/main.rs:3:25 | 3 | println!("{answer}") | ^ help: add `;` here 4 | 5 | answer = 42; | ------ unexpected token error[E0308]: mismatched types --> src/main.rs:5:14 | 2 | let mut answer = "What is the answer"; | -------------------- expected due to this value ... 5 | answer = 42; | ^^ expected `&str`, found integer For more information about this error, try `rustc --explain E0308`. error: could not compile `cannot-change-type` (bin "cannot-change-type") due to 2 previous errors