Exerpad
🔥 0
0 XP
Exercise 3 · Chapter: Tuples & StructsRequired+50 XP

Fix the Tuple

Oh no! This code tries to print the third item in a tuple, but it uses the wrong index!

Fix the code so it prints:

Favorite color: blue

Hint: Tuple indexes start at 0. A tuple with 3 items has indexes 0, 1, and 2 — not 3!

rust
fn main() {
let colors = ("red", "green", "blue");
println!("Favorite color: {}", colors.3);
}
Output
Run your code to see the output here.