Create a while
loop
This commit is contained in:
parent
99fb3a3f72
commit
31e890f49b
1 changed files with 6 additions and 16 deletions
|
@ -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;
|
|
||||||
}
|
|
||||||
if count == 2 {
|
|
||||||
break 'counting_up;
|
|
||||||
}
|
|
||||||
remaining -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
count += 1;
|
number -= 1;
|
||||||
}
|
}
|
||||||
println!("End count = {count}");
|
|
||||||
|
println!("LIFTOFF!!!");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue