No-nonsense input!(...)
macro for Rust.
use input_macro::input;
fn main() {
let name = input!("What's your name? ");
println!("Hello, {name}!");
let age: i64 = input!("How old are you today, {name}? ").parse().unwrap();
match age {
i if i < 0 => {
println!("Whoah, negative age! Impressive! ๐");
},
_ => {
println!("Happy Birthday! Congratulations! ๐ฅณ");
},
}
match input!("Do you like chocolate ๐ซ (y/N)? ").as_str() {
"y" | "Y" => {
println!("Yay! I like chocolate too ๐.");
},
_ => {
println!("Oh well, all the more for me ๐.");
},
}
}
MPL v2.0, see LICENSE