1
00:00:02,050 --> 00:00:04,950
Now, there also is another mathematical operation

2
00:00:04,950 --> 00:00:06,130
which I want to show you

3
00:00:06,130 --> 00:00:09,090
and that's the modulus operation,

4
00:00:09,090 --> 00:00:11,120
the modulus operator,

5
00:00:11,120 --> 00:00:15,820
which is this percentage sign character used as an operator.

6
00:00:15,820 --> 00:00:19,430
Now, if we save this and then run this again,

7
00:00:19,430 --> 00:00:24,430
we see two as a result for using this modulus operator.

8
00:00:24,750 --> 00:00:29,750
And what this modulus operator actually yields as a result

9
00:00:30,040 --> 00:00:32,240
is the remainder,

10
00:00:32,240 --> 00:00:36,880
the remaining part of performing a division here.

11
00:00:36,880 --> 00:00:40,900
And with that, I mean that if we divide ten by four,

12
00:00:40,900 --> 00:00:43,180
we would get two dot five.

13
00:00:43,180 --> 00:00:47,180
But the modulus operator does not return two dot five,

14
00:00:47,180 --> 00:00:49,970
but instead it simply has a look at

15
00:00:49,970 --> 00:00:54,450
how often this number by which we are dividing

16
00:00:54,450 --> 00:00:56,940
fits into this number.

17
00:00:56,940 --> 00:01:00,100
And then what would be the remaining number

18
00:01:00,100 --> 00:01:02,410
that can't be divided.

19
00:01:02,410 --> 00:01:06,790
So here of course, 4 fits into 10 two times.

20
00:01:06,790 --> 00:01:11,790
So it's two times four, and then we have a remainder of two,

21
00:01:12,830 --> 00:01:17,300
because two times four is eight and ten minus eight is two

22
00:01:17,300 --> 00:01:21,720
and modulus always returns us this remainder.

23
00:01:21,720 --> 00:01:23,640
So if I use it again here,

24
00:01:23,640 --> 00:01:26,740
but let's say we now use it with three.

25
00:01:26,740 --> 00:01:30,133
What would you expect here as a remainder?

26
00:01:31,240 --> 00:01:35,170
Well, we should get one as a remainder here

27
00:01:35,170 --> 00:01:38,630
because three fits into ten three times.

28
00:01:38,630 --> 00:01:43,630
And then that gives us nine and ten minus nine is one.

29
00:01:43,740 --> 00:01:48,130
So expected remainder is one.

30
00:01:48,130 --> 00:01:52,520
And if I save this indeed we get one here as a result

31
00:01:53,710 --> 00:01:56,163
and that's the modulus operator.

