use std::{thread, time::Duration};
fn main() {
println!("로켓트 카운드 타운 시작: ");
let mut while_x = 10;
while while_x != 1 {
// You can add your logic here
while_x -= 1; // Decrement the variable to exit the loop
// let mut while_x = 10; // Initialize a variable to control the while loop
// println!("Inside the while loop");
thread::sleep(Duration::from_secs(1));
println!("{} 초", while_x);
}
thread::sleep(Duration::from_secs(1));
println!("0 초 ~~~ 발사 ~~~~")
}
Result
로켓트 카운드 타운 시작:
9 초
8 초
7 초
6 초
5 초
4 초
3 초
2 초
1 초
0 초 ~~~ 발사 ~~~~