Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

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:

text
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);
}