Arithmetic Operators With Comparison Operators

The value returned by an arithmetic expressoin can be used to set a value like we've already seen:

let alfa = 4 + 9;

They can also be used directly as one half of an if expression with a conditional operator.

For example, instead of:

#![allow(unused)]
fn main() {
if 7 < 10 {
  ...
}
}

We could do:

#![allow(unused)]
fn main() {
if 3 + 4 < 10 {
  ...
}
}

We could even use arithmetic operations on both sides of the = sign like this example that outputs:

is the value more?
no

SOURCE CODE

fn main() {
  println!("is the value more?");
  if 3 + 4 > 5 + 5 {
    println!("yes");
  } else {
    println!("no");
  }
}

CODE RUNNER