fn main() {
println!("What is your age?");
let mut age = String::new();
std::io::stdin()
.read_line(&mut age)
.expect("Error");
let age: u32 = match age.trim().parse() {
Ok(n) => n,
Err(_) => {
println!("Invalid age");
return;
}
};
println!("Your age is {}", age);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: