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() {
|
||||
let mut count = 0;
|
||||
'counting_up: loop {
|
||||
println!("count = {count}");
|
||||
let mut remaining = 10;
|
||||
let mut number = 3;
|
||||
|
||||
loop {
|
||||
println!("remaining = {remaining}");
|
||||
if remaining == 9 {
|
||||
break;
|
||||
}
|
||||
if count == 2 {
|
||||
break 'counting_up;
|
||||
}
|
||||
remaining -= 1;
|
||||
}
|
||||
while number != 0 {
|
||||
println!("{number}!");
|
||||
|
||||
count += 1;
|
||||
number -= 1;
|
||||
}
|
||||
println!("End count = {count}");
|
||||
|
||||
println!("LIFTOFF!!!");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue