Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Fix the Countdown

This countdown is broken! It's supposed to count from 5 down to 1 and then print "Go!", but it never stops.

Fix the code so it prints:

text
5
4
3
2
1
Go!

Hint: Look at the comparison operator in the while condition. Is it checking the right thing?

rust
fn main() {
let mut n = 5;
while n >= 0 {
println!("{}", n);
n -= 1;
}
println!("Go!");
}