Operator Examples Flashcards
Name the operator and description
1
Q
2 + 4 == 6
A
+: Add
2
Q
2 - 4 == 2
A
-: Subtract
3
Q
2 * 4 == 8
A
*: Multiply
4
Q
2 ** 4 == 16
A
**: Power of
5
Q
2 / 4.0 == 0.5
A
/: Divide
6
Q
2 % 4 == 2
A
%: Modulus
7
Q
4 > 4 == false
A
>: Greater than
8
Q
“1”.to_i == 1
A
.: Dot access
9
Q
Module::Class
A
::- Colon access
10
Q
[1,2,3,4]
A
[]: List brackets
11
Q
!true == false
A
!: Not
12
Q
4 < 4 == false
A
<: Less than
13
Q
4 > 4 == false
A
>: Greater than
14
Q
4 >= 4 == true
A
<=: Greater than equal
15
Q
4 <= 4 == true
A
>=: Less than equal