Skip to content

Instantly share code, notes, and snippets.

@micaiah-effiong
Last active August 21, 2022 00:22
Show Gist options
  • Select an option

  • Save micaiah-effiong/67d447522ca5d9e63ac177d5bd2d50d9 to your computer and use it in GitHub Desktop.

Select an option

Save micaiah-effiong/67d447522ca5d9e63ac177d5bd2d50d9 to your computer and use it in GitHub Desktop.
Prompt for an input with a custom message. Similar to python input function
fn prompt(msg:&str) -> String {
println!("{msg}");
let mut input:String = String::new();
std::io::stdin().read_line(&mut input).expect("Could not read input");
return input;
}
let guess_value:String = prompt("How many times do you want to try");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment