How does the > operator work?

The > operator is a comparison operator used to determine if the value on the left side is greater than the value on the right side. It returns a boolean value: true if the left operand is greater than the right operand, and false otherwise.

Example in Rust:

fn main() {
    let a = 5;
    let b = 3;

    if a > b {
        println!("{} is greater than {}", a, b);
    } else {
        println!("{} is not greater than {}", a, b);
    }
}

In this example, the output will be 5 is greater than 3 because 5 is indeed greater than 3.

0 Comments

no data
Be the first to share your comment!