Last active
August 21, 2022 00:22
-
-
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
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 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