Welcome in his lecture, I'm going to show you as an elective branches, as I promised, and I'll talk
about a few rules by using the if statement.
OK, let's check it out.
This used as statement with Disko.
OK, now I'm going to type out with its own blog like this.
As branch can only be used when there is an if statement, so you cannot use it without an if statement.
All right, so anything declared in the if statements blog will be available in the blog, by the way,
but not vice versa inside the ALS blog.
I'm going to print LUL like this.
OK, listen.
It brings love, let me tell you why.
Yes, because this condition expression of the if statement was false is simple as that.
So as Esperance's block is executed instead, and it has printed low as a message, by the way, as
Branch is only executed when the if statements, all the other branches were false.
Let me show you what I mean by the other branches.
I've simplified the program a little bit to keep things easier to understand.
OK, I removed the valid variable from the statements condition sorry, but as Branch looks like a little
bit ugly now, but I'm going to fix it in a minute.
Nobody's.
OK, let's say that you want to display a special message when the score is equal to three is in here.
To do that, you need an as if statement like this one.
As you can see here, as of Branch, it looks like an IV branch because it really is like the if statement.
It has its own condition, expression only difference is that it starts with an ALS keyboard and it
should belong to an if statement right after the IV branch.
That's why it's called an active branch.
Now, then, as if statements and.
OK, Lieutenant.
It brings on the age cool.
Now let me explain what's going on here.
The score is not greater than three, right?
So the first if statement is skipped and then as if Branch's condition is checked, the score equals
three.
So two hours if Branch is executed a.
And as Branch Downbelow escaped as well, that's because as condition was true.
As I said, as branch only executed when all the branches are false.
Now, here are initialise, the scorable with a value of two.
OK, let's add one more active branch here.
It'll execute Vänskä is two, right?
OK, Lipman's.
It brings Matt, it's because the score is two, that's not a good score anyways.
Now, let's check out the rules of the IF statement.
First rule is that you can use the F branch in an if statement only once.
The second rule is that you can use as many active branches as you want.
Sky is the limit as you seen, as if Branch is completely optional.
You don't have to use it at all.
And the last rule is that similar to olive branch you can use and as branch only once is, you seem
like as if Branch as branch is also an optional branch.
It runs only when all the previous branches were false.
So in summary, that can be only one fifth and one as branch, but there can be multiple elusive branches.
It's that simple.
All right, that was all for now, see in the next lecture, the.