I want to take 2 user inputs, height and width:
fn main() {
let mut w = String::new();
let mut l = String::new();
println!("Enter the width");
io::stdin().read_line(&mut w).expect("failed to read input");
let w: i32 = w.trim().parse().expect("invalid input");
println!("Enter the length");
io::stdin().read_line(&mut l).expect("failed to read input");
let l: i32 = l.trim().parse().expect("invalid input");
println!("width {:?}", w);
println!("length{:?}", l);
}
Is there a shorter way to achieve this?