Welcome back everyone.
All right there's one other type of statement that you can use and it's going to put a couple of times
and I mean to type in else ifs.
All right.
And I'm going to go ahead and put it to Crilley brackets and there we go.
Now the other thing you need to do is you don't need to make sure that these are touching like that.
OK.
And so we're going to do is there's only one other thing that we need to do.
We need to type in two two brackets like this and we're going to say if cool number is double equal
to to get any zero all the warnings disappear.
And what I'll do is I'll just type in an alert.
And just to see if this works here and we'll just type pop or something like that.
OK.
There you go.
So if cool numbers equal to 2 This should just end up being an alert.
OK.
And if I put change the text here and you want to make sure that everything is working here.
So there you go.
And there we go.
It works now.
So the way this works is that this this again computers read lines like you read books line by line
and they read every line.
So what it does is that when this function is called and remember its function being called from this
h T.M. here this function is called If Coola is equal to 1.
It does this k.
If it's doesn't equal to 1 Be Next we then go to the else if you know cool number is equal to 2.
And this case number is equal to 2.
And then we go ahead and run this code and if cool number is not equal to 2 it will run whatever's in
the else statement.
So if I just type in fun here you can see the statement is fired.
OK.
That's pretty much what it is here.
Now the other thing is that you can't have two statements out of the same.
OK so you can see that number two is equal to two.
And then if you type something in differently here then it is going to throw an exception here.
You notice how there isn't any warnings here.
And the reason is that again javascript likes to make things work.
It's actually quite awesome.
But what you can do is you can see is equal to three and you can just type in something else here so
cool numbers equal to three.
And if I type something in here for example like this you can see that the whatever code was in the
else if statement.
The second one is fired here.
So the order or the higher key as you will you will go from if to LCF to else.
OK.
And again it reads that line by line.
Now when you're making your LCF statements it's best that you make them in any kind of logical order.
So if you're doing things numerically like I've done here.
So we have cool numbers equal to 1 then we do this if Khona else if cool numbers equal to two.
Then we do this and LCF cool number is three.
We do this this as well and it's not like 1 2 4 3 or something like that you want to make sure that
it's actually quite easy to understand.
OK.
And of course you can have a ton of else if statements you can have 50 100.
Now one thing about if statements is that there are a pretty important part of programming.
However you don't want to rely on if statements only.
So as you get become a better programmer you'll find better ways to do things other than if statements
so you have an if statement.
It's it works really well.
I mean every program has an IF statement in there somewhere.
But at the end of the day you want to eventually grow out of the statement.
All right I'll see you guys in nice tutorial.