# main.rs - source
Source of the Rust file `src/main.rs`.
Keywords: rust, rustlang, rust-lang

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29

    use std::io;
    use rand::Rng;

    fn main() {

        println!("Guess the number!");
        println!("Enter your Guess: ");

        let mut guess = String::new();
        let secret_number = rand::thread_rng().gen_range(1..=100);

        println!("The secret number is : {secret_number}");

        io::stdin()
                .read_line(&mut guess)
                .expect("failed to red line");

        println!("You Guessed : {guess}");

        println!("You guessed: {guess}");

        match guess.cmp(&secret_number)
        {
            Ordering::Less => println!("Too small!"),
            Ordering::Greater => println!("Too big!"),
            Ordering::Equal => println!("You win!"),
        }
    }