코딩Coding/Rust연습
Rust연습❤️“rust spinning rod animation in text” Code Answer
내인생PLUS
2022. 8. 13. 23:43
728x90
fn main() {
let characters = ['|', '/', '-', '\\'];
let mut current = 0;
println!("{}[2J", 27 as char); // Clear screen.
loop {
println!("{}[;H{}", 27 as char, characters[current]); // Move cursor to 1,1 and output the next character.
current += 1; // Advance current character.
if current == 4 {
current = 0;
} // If we reached the end of the array, start from the beginning.
std::thread::sleep(std::time::Duration::from_millis(250)); // Sleep 250 ms.
}
}
/
이게 회전함. ㅎㅎㅎ 신기하다. ㅋㅋ
https://www.codegrepper.com/code-examples/rust/rust+spinning+rod+animation+in+text
반응형