Create a while loop

This commit is contained in:
Manuel Thalmann 2024-10-16 17:18:41 +02:00
parent 99fb3a3f72
commit 31e890f49b

View file

@ -1,21 +1,11 @@
fn main() { fn main() {
let mut count = 0; let mut number = 3;
'counting_up: loop {
println!("count = {count}");
let mut remaining = 10;
loop { while number != 0 {
println!("remaining = {remaining}"); println!("{number}!");
if remaining == 9 {
break; number -= 1;
}
if count == 2 {
break 'counting_up;
}
remaining -= 1;
} }
count += 1; println!("LIFTOFF!!!");
}
println!("End count = {count}");
} }