Logical Operators
The operators $>$, $\geq$, $<$, $\leq$, $=$, and $\neq$ are called logical operators. They are used to compare two values and the output states whether your statement is TRUE or FALSE.- " $>$ " is used to see if $a$ is strictly greater than $b$, $a > b$.
- " $>=$ " is used to see if $a$ is greater than or equal to $b$, $a \geq b$.
Click the Run button to evaluate these logical expressions.
# no pec
# Strictly greater than
5 > 4
2 > 2
# Greater than or equal
5 >= 4
2 >= 2
- " $<$ " is used to see if $a$ is strictly less than than $b$, $a < b$.
- " $<=$ " is used to see if $a$ is less than or equal to $b$, $a \leq b$.
Click the Run button to evaluate these logical expressions.
# no pec
# Strictly less than
2 < 7
5 < 5
# Less than or equal
2 <= 7
5 <= 5
- " $==$ " is used to see if $a$ is equal to $b$, $a = b$.
- " $!=$ " is used to see if $a$ is not equal $b$, $a \neq b$.
Click the Run button to evaluate these logical expressions.
# no pec
# Equal
2 == 2
6 == 4
# Not equal
6 != 4
2 != 2