21 lines
529 B
Rust

use std::io;
fn main() {
println!("Guess the number!");
println!("Please input your guess: ");
// ::new() is an associated type. Function is implemented on this type
// Returns a new instance of String
let mut guess = String::new();
let apples = 5; // immutable
let mut bananas = 7; // mutable
io::stdin()
.read_line(&mut guess)
.expect("Failed to read line!"); // Use this if truly want to error out. Use pattern matching otherwise
println!("You guessed: {}", guess);
}