Bummer! This is just a preview. You need to be signed in with a Treehouse account to view the entire video.
Start a free Basic trial
to watch this video
When we add or subtract numbers, the "+" and "" characters are known as operators. Let's go ahead and learn more about operators in this video.
List of Operators

*
(Multiplication) 
/
(Division) 
%
(Modulus, remainder) 
**
(Exponent)
Practice
Using Workspaces, try using the different operators on different combinations of numbers and variables.
Modulus Operator
The modulus operator can be a bit confusing. Here are the docs, so you can read further.

0:00
So far we've been working with numbers by doing addition and subtraction.

0:06
Now, this wouldn't be a very good calculator, if all we could do was add and

0:11
subtract.

0:13
Let's go ahead and try other map now, inside of IRB.

0:19
So I'm going to create some numbers here, a is 2 and b is 2.

0:27
Now we know that we can add these together.

0:30
And we know that we can subtract them.

0:32
But we can also multiply them.

0:35
So I can do, a times b.

0:39
Now, in a programming language, we use the asterisk

0:44
key to denote multiplication, and 2 times 2 is 4.

0:49
We don't need to this with variables.

0:52
We could do any numbers that we wanted.

0:55
So we could do 3 times 9, and that will give us 27.

1:00
We can also do division.

1:03
I could do 9 divided by 3, which gives us 3.

1:08
In addition, if we wanted to know the exponent of a number,

1:12
we do that by typing the asterisk key twice.

1:20
2 to the 1/3 is 8.

1:24
There is another operator that we can use called modulus.

1:29
And that is the remainder after division.

1:33
So if we did 2.

1:37
% 2.

1:40
The remainder is 0.

1:45
If we did 3% to the remainder, would be 1.

1:50
When we perform addition, subtraction, multiplication, and

1:55
all of those other things,

1:58
the symbol that comes in between the two numbers, is called the operator.

2:03
There will be a list of operators below this video free to try out in IRB.

2:09
Go ahead and give it a try now.
You need to sign up for Treehouse in order to download course files.
Sign up