00:01
Hello, welcome to this lesson.
00:02
In this lesson, we'll rewrite an entire code searchment using switch statement instead of the if else.
00:14
Okay, so the first one we have an integer which is a variable and which is an integer.
00:22
Then we have a which is equals to 1d is 2.
00:30
We have c that is 3.
00:34
We have d that is 4.
00:35
So the next thing is that we ask for user input using the c -e.
00:51
We store that to the end.
00:55
And now we use switch case, so say switch.
01:00
So these are the cases.
01:07
The first one was if n is equals to carry.
01:10
So we'll say case, carry.
01:16
If n is called to carry, then we have a.
01:20
Is equals to a plus one.
01:28
We have to break.
01:32
The next one, we have a case or else if and is equals to 7 or 8.
01:42
So this time instead of having two cases for 7, also 8 would.
01:50
Instead of having else if and it equals to 7 or 8, we will do a case for 7.
02:02
A case for 8.
02:04
Okay, we will not break it at 7.
02:07
It means that both cases will share the same thing.
02:11
And now what they share is b is equals to b plus 1.
02:21
Now we break.
02:23
It means that if we have a case 7, the case 8, the same thing will be done, which is b is called 2.
02:30
B plus 1.
02:32
The next one is else if.
02:35
And it's greater than 10 and then is less than 13 okay so looking at greater than 10 greater than 10 and less than 13 is 12 uh it's 11 and 12 okay so if and is between 11 and 12 so we'll say oops, 12.
03:19
Okay...