Practice
Try these problems in your head, or on paper. Then see how they work in the Ruby shell (IRB).
1) 2 + 3 + 5
2) 10 - 3
3) 9 / 3
4) 4 * 2
5) 4 ** 2
Now for some harder ones.
6) What is the result of 11 % 5 ?
7) What is 14 % 3 ?
8) A wizard carries two numbers (one even and one odd) in each hand. He won't open his hands to show you, but he will let you use modulo. Your task is to find out which hand holds an even number, and which holds the odd.
Hint: A number divided by two, with no remainder, is even.