You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::io;use std::process;fnmain(){loop{println!("Please enter the first number: ");letmut first = String::new();
io::stdin().read_line(&mut first).unwrap();let a:u32;match first.trim().parse(){Ok(value) => a = value,Err(_error)=> {eprintln!("This is unfortunately not a number");
process::exit(1)}};println!("Please enter the second number: ");letmut second = String::new();
io::stdin().read_line(&mut second).unwrap();let b:u32;match second.trim().parse(){Ok(value) => b = value,Err(_error)=> {eprintln!("This is unfortunately not a number");
process::exit(1)}};let result = sum(a, b);println!("Result: {}", result);}}fnsum(a:u32,b:u32) -> u32{
a + b
}
https://github.com/prophen/intro-to-rust/blob/nikema's-notes/exercises/09.md
The text was updated successfully, but these errors were encountered: