Created
August 20, 2024 15:25
-
-
Save JaiSuryaPrabu/f17db4f5eaef49d46768d81bea934497 to your computer and use it in GitHub Desktop.
Tic Tac Toe function for getting player input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn get_input() -> String { | |
println!("Enter your choice : "); | |
let mut input = String::new(); | |
io::stdout().flush().unwrap(); | |
io::stdin().read_line(&mut input).expect("Enter correct input"); | |
Command::new("clear").status().unwrap(); // clears the screen | |
return input.trim().to_string(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment