Common operators Flashcards
4 + 3
Adds two numeric values
Operator is +
Value: 7
-(-2)
Reverses the sign of one numeric value
Operator is - (unary)
Value: 2
11 - 5
Subtracts one numeric value from another
Operator is - (binary)
Value: 6
3 * 5
Multiplies two numeric values
Operator is *
Value: 15
4 / 2
Divides one numeric value by another
Operator is /
Value: 2
5 % 2
Divides one numeric value by another and returns the integer remainder
Operator is % (modulo)
Value: 1
5^2
Raises one numeric value to the power of another
Operator is ^
Value: 25
1 = 2
Compares two values for equality
Operator is =
Value: FALSE
1 != 2
1 <> 2
Compares two values for inequality
Operator is != <>
Value: TRUE
2 < 2
Compares two values with <
Operator is <
Value: TRUE
2 <= 2
Compares two values with <=
Operator is <=
Value: TRUE
‘2019-08-13’ > ‘2021-08-13’
Compares two values with >
Operator is >
Value: FALSE
‘apple’ >= ‘banana’
Compares two values with ≥
Operator is >=
Value: FALSE
TRUE AND FALSE
- The “AND” operator ensures that all conditions must be true for it to return true.
- If either value is false, the result is false.
Operator is AND
Value: FALSE
TRUE OR FALSE
Returns FALSE only when both values are FALSE
Operator is OR
Value: TRUE