WEBVTT

00:00.910 --> 00:01.790
Hello, everyone.

00:02.110 --> 00:09.130
So in this particular session, we will learn about if conditions, but before learning about if conditions

00:09.130 --> 00:14.550
and knowing what exactly they are, we need to understand why the village required.

00:14.950 --> 00:18.270
So let us look at this piece of code there.

00:18.280 --> 00:24.610
I have value of geek as baking, which means that cake is baking.

00:24.940 --> 00:28.200
So we print the message that he is making.

00:28.630 --> 00:34.300
After that, we will print a simple message as good bye.

00:36.110 --> 00:40.730
Now, when I run this, I get the message, cake is baking and goodbye.

00:41.420 --> 00:47.240
Now, let's say we have a situation where cake might not really be baking.

00:47.660 --> 00:52.370
So in that case, the value of cake will be.

00:55.100 --> 01:05.150
Not picking, OK, so we in that particular case, we want to bring cake is not making any sort of cake

01:05.150 --> 01:06.700
is OK.

01:07.400 --> 01:09.190
So this is the dessert for us.

01:09.860 --> 01:16.600
Now, let us say we want to have both of these cases in our piece of code.

01:16.940 --> 01:20.810
Now, what will we do to have both of these considered?

01:21.200 --> 01:30.830
So in that case, we will be using if conditions, the if condition allows us to have responses to different

01:30.830 --> 01:36.170
scenarios or different situations which occur, why the program is running.

01:37.040 --> 01:41.630
So let us see if the value of variable cake is baking.

01:41.810 --> 01:48.230
Then I want to bring that cake is baking and the value when it is not baking, then I want to bring

01:48.230 --> 01:49.640
that cake is not baking.

01:49.760 --> 01:52.130
So I want to be these two options.

01:52.310 --> 01:55.580
So in that situation I can use if conditions.

01:56.360 --> 02:01.160
So let us suppose to that how we will write the if condition.

02:01.640 --> 02:07.940
So to write the if condition, we will have to first of all see if.

02:09.370 --> 02:13.120
And then we write the condition, so the condition is.

02:14.070 --> 02:14.630
Greg.

02:15.650 --> 02:16.910
Is equivalent to.

02:18.350 --> 02:18.920
Making.

02:21.340 --> 02:22.720
Now, consider this.

02:23.830 --> 02:32.470
The value of Kek has to be exactly breaking if I write Capital B, then this will not be equal to this

02:33.040 --> 02:35.400
because both of these strings are different.

02:35.890 --> 02:37.900
So we need to keep it as making.

02:39.000 --> 02:48.720
Then the apply of Golan, which means that the if condition is starting so doesn't exist if.

02:49.740 --> 02:53.040
Followed by the condition which we are trying to evaluate.

02:54.320 --> 03:00.380
Then fallen and then automatically, when you hit enter, you get this indentation.

03:01.290 --> 03:07.980
In case you do not get an indentation, you can press up and get this indentation and the whole piece

03:07.980 --> 03:13.590
of gold, which will be hot, which will be a part of this if condition would be written after this

03:13.590 --> 03:14.310
indentation.

03:14.880 --> 03:19.560
So let us see if Gache is baking, then we want to print.

03:22.920 --> 03:24.900
OK, and speaking.

03:26.420 --> 03:28.010
OK, and.

03:30.550 --> 03:32.710
This is a simple if condition.

03:33.000 --> 03:37.000
OK, after that, we want to print.

03:39.830 --> 03:40.490
Good bye.

03:42.440 --> 03:49.190
So when we say cake is baking, so it will, first of all, evaluate this particular condition, it

03:49.190 --> 03:53.020
will check if the value of cake is equivalent to this baking.

03:53.450 --> 04:00.830
If the response of this condition evaluation is true, then only it will run whatever piece of food

04:00.830 --> 04:07.310
would be present after this indentation, we could have more piece of code here, say like print.

04:08.990 --> 04:09.590
He.

04:20.130 --> 04:24.770
And many we could have any number of lines of code present here.

04:25.140 --> 04:32.960
And when I do not have this emendations, this means that this is outside this if condition.

04:33.210 --> 04:40.640
So no matter the cake is equivalent to baking or not, this line of code would anyhow be printed.

04:40.920 --> 04:48.660
This would run in any situation, only these lines of code, which are a part of this if condition will

04:48.660 --> 04:54.600
be run, if this key value, the value of the variable cake is equal to baking.

04:54.630 --> 04:56.160
So let us try that.

04:57.060 --> 04:58.070
So here you can see.

04:58.860 --> 05:02.280
So the value of geek's all letters.

05:03.410 --> 05:07.820
Run this one, so here the value of cake is equal to baking.

05:08.220 --> 05:15.260
Now I am running this so you can see that it is giving this value cake is baking, cake is and then

05:15.260 --> 05:15.650
goodbye.

05:16.460 --> 05:19.960
Now let us see how these conditions work, OK?

05:21.200 --> 05:26.780
So here we can see that the control flow will come to this if condition.

05:27.670 --> 05:32.810
And once the controlled flow comes to this condition, it will evaluate the condition which is present

05:32.810 --> 05:36.040
to you now after this evaluation.

05:37.010 --> 05:46.370
If there is any Nortman or non-zero value, it will correspond to two, and if the value is zero or

05:46.370 --> 05:48.710
null, it will be false.

05:49.650 --> 05:57.980
OK, now here we evaluate this particular condition and once we evaluate this condition, if the value

05:57.980 --> 06:07.160
is false, then the false expression would be run and the value is true, then the true expression would

06:07.160 --> 06:11.470
be done and after that it will go to the next statement.

06:12.710 --> 06:19.390
This is the condition of if so, if the condition is true, then this would be wrong.

06:20.000 --> 06:26.130
And if it is false, then we will have to provide the LS condition.

06:26.330 --> 06:27.990
Now what is its condition?

06:28.880 --> 06:34.520
So we see this that this is equivalent to making this condition is true.

06:35.210 --> 06:36.980
Then it runs this piece of wood.

06:37.220 --> 06:37.840
Now what.

06:37.840 --> 06:41.970
This cake is not equal to making so us run this piece of code.

06:41.990 --> 06:45.680
So once I run this, the value of geek has been updated law making.

06:46.130 --> 06:53.720
So now if I run this piece of code, it will not show me any messages because I have not given any is

06:53.810 --> 07:02.850
condition, but it will bring good barbarically now in case we want to provide a false condition.

07:02.870 --> 07:07.540
Also, we want to provide a response to the false criteria.

07:07.760 --> 07:09.950
In that case, we will write is.

07:11.210 --> 07:17.920
What Colin and whatever piece of code we want to done as a part of is we will write in below it.

07:18.350 --> 07:20.420
So let us say we want to run this only.

07:21.560 --> 07:23.270
So let me put this here.

07:26.020 --> 07:29.350
So now this line of code will run.

07:30.440 --> 07:37.460
If this condition is not to say the condition is true, it will run this piece of code and if the condition

07:37.460 --> 07:39.570
is not true, it will run this piece of good.

07:39.770 --> 07:41.370
So let us run this again.

07:42.080 --> 07:45.920
So now you can see we get the value Qik is not making.

07:45.920 --> 07:46.730
And then good bye.

07:46.730 --> 07:47.210
Good bye.

07:48.180 --> 07:48.550
Right.

07:48.780 --> 07:53.190
This is one scenario now we can have a simple if.

07:54.570 --> 07:57.960
Apart from that, we can have if and is both.

07:59.550 --> 08:08.360
That is one more condition where we can have if if I live and it's so, let us see how that works out.

08:09.450 --> 08:14.040
So we have a condition, if it's condition, if anything else.

08:14.520 --> 08:16.500
Now, let us see what these Chinna.

08:18.640 --> 08:23.440
Now, if you see this so first of all, it will verify this if condition.

08:24.450 --> 08:31.200
If the condition is true, then it will run the good luck, which is a part of this if condition, and

08:31.200 --> 08:36.120
then it will directly go to the end of the if condition.

08:36.510 --> 08:38.310
Oh, I'm Randy.

08:39.760 --> 08:41.490
Next, lines of code.

08:42.540 --> 08:49.950
Now, if this if condition is not true, then it will go to the next ayliffe expression, so it will

08:49.950 --> 08:51.760
evaluate this expression.

08:51.960 --> 08:57.010
Now if this expression is true, it will run this of block and then go to the end of it.

08:57.270 --> 09:01.440
Now, in case this is not true, then it will evaluate the next condition.

09:01.710 --> 09:05.420
If next condition is true, it will run that particular good luck.

09:05.580 --> 09:10.230
If it is not true, then it will go to the very next is good luck.

09:10.410 --> 09:15.660
If none of these if elif the codes are true then it will go to the end.

09:15.750 --> 09:17.880
Good luck and simply run.

09:17.890 --> 09:19.830
This is good.

09:20.050 --> 09:24.660
I run this one and stop or go to the next line of food.

09:25.850 --> 09:29.390
Now, let us see this in action, so we have this.

09:33.790 --> 09:35.830
So let's do it this way.

09:37.350 --> 09:43.490
So we have if Jake is making if it is not breaking, then we are doing this now.

09:43.500 --> 09:44.310
Let us see.

09:46.090 --> 09:52.900
If he is equivalent to baking, then this cake is making now Elif.

09:57.710 --> 10:02.810
Now, this is another if kind of a condition, so we need to give a condition here, if they don't give

10:02.810 --> 10:04.090
a condition, will not rule.

10:04.490 --> 10:06.800
So we need to give a condition sick.

10:08.230 --> 10:09.430
Is equivalent to.

10:11.340 --> 10:12.030
Beit.

10:13.680 --> 10:18.210
Then you want this particular piece of food to be run, so we want to bring.

10:31.850 --> 10:32.420
Then.

10:33.590 --> 10:39.170
We can have another day, live condition, we can have any number of live conditions here, so let us

10:39.170 --> 10:39.930
take.

11:03.030 --> 11:08.760
So we say no gig today, so let us try different scenarios here by changing the values of.

11:16.570 --> 11:21.400
So first of all, if the value of cake is baking.

11:27.340 --> 11:31.150
And we've done this so we get results as.

11:32.080 --> 11:45.850
Cake is baking, cake is, and then the final goodbye in case the value of cake is baked.

11:48.150 --> 11:53.040
We get cake is not baked, a cake is not baking.

12:00.130 --> 12:08.000
Now, see here, the give baked with a small V. So idiotically went to the ends condition.

12:08.200 --> 12:09.580
So what happened here?

12:09.580 --> 12:14.080
Is it checked if the key value is baking.

12:14.470 --> 12:15.840
So it was not true.

12:15.850 --> 12:18.010
So it went to the next live condition.

12:18.340 --> 12:21.410
A. The geek's value is baked with a capital B..

12:21.430 --> 12:22.620
Now, this is not true.

12:22.990 --> 12:28.420
So it went to the next Ayliffe condition here to check if it is equivalent to don't like.

12:28.630 --> 12:30.090
So this is not equal to go.

12:30.100 --> 12:31.090
No, don't like.

12:31.100 --> 12:39.100
So it went to the is condition and granted finally now in case the value is capital B capital be baked.

12:39.460 --> 12:46.450
So now what will happen is it will bring cake is baked already and then it will train the next lines

12:46.480 --> 12:46.910
of code.

12:47.350 --> 12:54.520
And here if we have a don't like then it will just bring the message today and then goodbye.

12:55.940 --> 13:04.550
So this is about if conditions they are discussed about the if ayliffe conditions, we can also create

13:04.550 --> 13:12.770
misted if conditions which would have further indentation now while creating the indentation, one has

13:12.770 --> 13:16.300
to make sure that they do not get confused.

13:16.670 --> 13:21.230
So let us dry how we can create nested indentation you.

13:24.750 --> 13:29.130
So here we have a if condition, so let us try to create.

13:31.170 --> 13:32.580
Anaesthetise condition.

13:34.010 --> 13:38.530
So let us say we want to have a condition inside this flipflop.

13:39.670 --> 13:41.680
And here we want to evaluate.

13:51.820 --> 13:52.480
OK.

14:19.730 --> 14:20.750
Food is yummy.

14:23.000 --> 14:23.690
And.

14:25.230 --> 14:29.040
Let us say we want to have another if condition inside this.

14:53.000 --> 14:56.760
We can use El Sol Trujillo, but we are just using if.

15:26.870 --> 15:35.270
So here, if you see, we have created this foundation, which has further information inside this envelope,

15:35.930 --> 15:39.890
and it has some of the if condition, which has further information.

15:40.130 --> 15:48.380
Now, if you see each condition has a further indentation associated with it, this is the last condition.

15:49.330 --> 15:57.700
And this is the next if blog and prior to this, this was the original invasion, which we had.

15:57.970 --> 16:00.070
So let us give the bad news.

16:00.070 --> 16:00.580
Do it.

16:01.240 --> 16:02.170
Let us see.

16:03.390 --> 16:05.930
Geek is don't like.

16:08.630 --> 16:10.280
And let the food.

16:11.510 --> 16:12.110
The.

16:16.100 --> 16:20.420
Now, let us run this piece of code so we can say no today, food is yummy.

16:20.430 --> 16:20.630
Good.

16:21.710 --> 16:22.490
So.

16:24.760 --> 16:33.850
Cake is don't make so it says no cake today, then we have a food equal to tasty, then it is saying

16:33.850 --> 16:37.250
that food is yummy and finally saying goodbye.

16:37.570 --> 16:42.970
Apart from this, we can let us just change it a little bit.

16:44.400 --> 16:48.270
And then it says, no gig today, and that is good bye.

16:53.560 --> 16:57.130
We can also convert this into an air condition.

16:59.670 --> 17:01.020
And this.

17:05.260 --> 17:08.440
And for this, we will have to remove this emendations.

17:11.420 --> 17:20.840
So now you can see that it has value, not the one place so close to this ayliffe block, it will run

17:21.020 --> 17:22.890
this entire piece of code.

17:23.480 --> 17:26.750
So the first statement is no cake today.

17:26.760 --> 17:30.250
So it Prinstein then it evaluates this if condition.

17:31.100 --> 17:33.820
Now it checks of full value is tasty.

17:33.890 --> 17:36.860
So it is not d d d d d one.

17:37.160 --> 17:40.310
So it moves to the S condition and runs it.

17:41.820 --> 17:43.800
So, again, give me chocolate and good goodbye.

17:44.770 --> 17:46.660
So that is if condition.

17:46.700 --> 17:47.200
Thank you.
