Skip to content

Instantly share code, notes, and snippets.

@JaiSuryaPrabu
Created August 20, 2024 15:25
Show Gist options
  • Save JaiSuryaPrabu/f17db4f5eaef49d46768d81bea934497 to your computer and use it in GitHub Desktop.
Save JaiSuryaPrabu/f17db4f5eaef49d46768d81bea934497 to your computer and use it in GitHub Desktop.
Tic Tac Toe function for getting player input
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