mirror of
https://github.com/ArthurDanjou/hellorust.git
synced 2026-01-14 12:14:35 +01:00
update project
This commit is contained in:
26
src/loop.rs
Normal file
26
src/loop.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
fn main() {
|
||||
let mut count = 0;
|
||||
'counting_up: loop {
|
||||
println!("count = {}", count);
|
||||
let mut remaining = 10;
|
||||
|
||||
loop {
|
||||
println!("remaining = {}", remaining);
|
||||
if remaining == 9 {
|
||||
break;
|
||||
}
|
||||
if count == 2 {
|
||||
break 'counting_up;
|
||||
}
|
||||
remaining -= 1;
|
||||
}
|
||||
|
||||
count += 1;
|
||||
}
|
||||
println!("End count = {}", count);
|
||||
|
||||
for number in (1..4).rev() {
|
||||
println!("{}!", number);
|
||||
}
|
||||
println!("LIFTOFF!!!");
|
||||
}
|
||||
@@ -22,7 +22,6 @@ fn main() {
|
||||
Err(_) => continue,
|
||||
};
|
||||
|
||||
|
||||
match guess.cmp(&secret_number) {
|
||||
Ordering::Less => println!("Too small"),
|
||||
Ordering::Greater => println!("Too big"),
|
||||
@@ -34,4 +33,4 @@ fn main() {
|
||||
|
||||
println!("You guessed: {}", guess);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user