Exercise 6 · Chapter: Linear ProgramsRequired+50 XP
Fix the Concatenation
This program should print a sentence about a pet, but the format!() placeholders are wrong. Fix it!
Expected output:
My dog is named Buddy and is 3 years old.
rust
fn main() {
let animal = "dog";
let name = "Buddy";
let age = 3;
println!("My {} is named {} and is {} years old.", name, age, animal);
}
Output
Run your code to see the output here.