Now we have it as if statements, so this is also similar to statement, but weekend you might improve
conditions, say if accommodation is met, then bad conditions it blog will be executed, then we have
to begin on another condition.
If this condition is not true, it will check this condition and if it is true, then it will execute
that block.
Then if both of these conditions are not true, then it will execute that.
In a statement.
So multiple levels of as simple as possible, like if one condition is not met, you can check on another
condition.
Again, you can read my motors is defined by another condition and ticket.
Similarly, you can have multiple conditions and if any of these conditions are met, that will be executed
if not meant that last year's blog will be executed.
We will see this program in action.
Do I understand the concept, a concept of if statements?
So here again, see that this one also flowchart, but also so it will execute that condition.
If it is true, it will execute that conditions body.
If it is false, it will text the next expression and then it is.
If it is true, it will execute that body and it will again go to the condition.
Check if that on my brain, like if first statements coming up, this will go on like this.
So if it is a fine, it as a condition, we are objecting.
If it is not true, then it will go to that statement.
Then we have one more type of your statement, which is quite nice, steady.
So instead of, it's actually simple concept if we are having a condition and it is coming through and
then inside that if we are checking for another condition and if that is true, we are executing that
block of statements that kind of these statements are part nested if statement.
So I would be willing to somebody if I am comparing to values, yeah, greater, then we then surely
we need to execute this so we can say that I am again comparing if we're greater than C, then you have
to execute this statement, which means like if a is greater than me, then only this can broadly get
into this if block.
Then from there it will check for you greater than see.
Then only it will go to this block and execute that values.
If this is true, then it will execute this block if this condition becomes false, if there are any
other statement inside this block, it will execute that.
If ward this conditions are not true, then it will go to the end of this block.
So that is why we use.
If any of you understood that, maybe I gave you a symbolic summary.
I have file as here and I have three asked me and I have four asks See?
So far, greater than three is through.
So it comes to this statement then taking fire Great Britain SEISS four five events for that is also
true, then it will print it if I am writing print here, print, they're just citing print, not looking
at this index and all just to make you understand.
So if I'm writing Print Day here, then it will print that despair.
But if it is not in the case, it be six.
If B six five greater than six is four.
So this will not enter a dollar in this block, so it will not execute the coming statement after that.
Suppose if these six, not six means three and C's six, then what that means five greater than three
is true.
Then it will end and the block, then it will take four or five grand plan six expires.
So this if statement will be skipped and if there are any statement, I would say that that will be
executed.
Similarly, we can use street statement if they want to have it condition checking.
If I have a lot of condition to check, then I can use this.
So it's an alternative to if as if suppose if I have a very variable rate and if like a variable can
be anything right.
So if those variable is matching to any of the constants on the seats, then it will actually execute
that that case.
So it will be like if switch, we will have any variable on expression order.
Yet it is the case one or case match is that if that case is true, then it will execute that statement
or set up that statements and go to that in block.
If that is not conditional statement, then we are checking second condition.
If it is true, it will go to the second set of statements and it will execute and go to that end of
it.
But there are like 10 conditions and one and two on an argument.
So if it is like the third one is meant, then it will go to that statement number three and execute
that like that it will execute which condition is actually meant.
That will be true and then back, but will be executed if none of the conditions are true.
We have it be false statement and which will execute before statement.
So how we can see this, we can see it in action in a program, then generally we'll get more idea switch.
So let's see every one of those concept in action.
Let's go to our demo session.
So in order to help you understand the concept of if statements I have it program over here would give
statements.
Suppose I have to pray.
And I'm like a month corresponding to the month, so January one, foster Monday, February 2nd.
So if a user is inputting the value of and one that is fine, it means me, then that should be printed.
So this is the program which will actually show the month the name according to that month the number.
And this is using the concept of if there's if so, you can see out here, I have all that important
parts of the program ready.
Then I am declaring the value to get the number of the month that is and then I am printing the number,
then I am asking for that one, the number again.
So you will know that if any call the one, it means it's January.
So you have to get the output generated, if any or do you have to get February?
So here you can see how beautifully I had used the concept of effect.
So if any one then print January, yes.
If this is the same next year, if an equal to two, so the condition is to check in equal to two,
if that is met, then print February.
Similarly, Abdul 0:48 I have this April's block and lastest as part because I don't have any more condition
to check.
Just check if the number is not equal to any of this one to 12.
Then it means like you also have given back month number only the right input is 11:59, right?
If any number is coming out, say that there is no money associated with it, so we have to print any
false statement card.
Yes, see our invalid number and please try.
So that's the message we will be printing.
So we will be just putting ads at Dallas because there is no father condition to check and then we will
be ending that program so we can see this program in action.
Two that I will be clearing make.
I'm so like first and then I will be executing the program.
So why does the command for compiling the program?
It is G Plus Plus space.
What is a program name, right?
Filing if?
Statement CBP, not CBP.
That's my file name.
I am campaigning it.
No, IRA's, if there are any of us there, we will take lot of messages coming in between.
But my program is correct so that I don't know, I guess.
No, I can't execute the program.
Dot slash it out.
See, it's asking me for the month.
No.
So let me give you the 10 as the no end.
So it's October, right?
So that satellite value we have got because what happened in West End?
So I checked here, it is not true.
So it said the next condition, it is not true.
Similarly, went down and checked that condition.
No.
And right, that just any time, so there is a match, so it executed that statement on that locally.
All of that block didn't execute.
So hope you have answered this.
So now we can move to that.
Late one more time, I will execute this program and see if I'm executing, if I'm giving any number
outside of the 12 part would happen.
So that's one, right?
So we can execute it, dodge slash and our dog and I will be giving them on December 14 invalid.
No, please try again, right?
Say destroying the right output.
So now let's move to that sweet statement.