How to clear the terminal screen in Rust after a new line is printed?
You can send a control character to clear the terminal screen. fn main() { print!(“{}[2J”, 27 as char); } Or to also position the cursor at row 1, column 1: print!(“{esc}[2J{esc}[1;1H”, esc = 27 as char);