Fix the Range
The code below should print the numbers 1 through 5, but there's a bug in the range. Can you fix it?
Expected output:
text
1 2 3 4 5
Hints:
- Look carefully at the range — does it start and end at the right numbers?
- Remember:
0..5gives 0, 1, 2, 3, 4 — not 1 through 5! - Try using
..=if you want to include the end number
rust
fn main() {
for i in 0..5 {
println!("{}", i);
}
}