Check out example codes for "rust guessing game". It will help you in understanding the concepts better.

Code Example 1

//Guessing Game from Rust Book
use std::io;
use rand::Rng;
use std::cmp::Ordering;
fn main() {
    let secret:i32 = rand::thread_rng().gen_range(1, 101);
        println!("Ingresa un número: ");
        let mut guess = String::new();
        io::stdin().read_line(&mut guess).expect("Failed to read line");
        let guess:i32 = match guess.trim().parse(){
            Ok(num) => num,
            Err(_) => continue,
        //print!("tu numero {}", guess);

        match guess.cmp(&secret){
            Ordering::Less => println!("Más arriba!"),
            Ordering::Greater => println!("Más abajo!"),
            Ordering::Equal => {
                println!("Ese mismo compadre");

Learn ReactJs, React Native from