I've got some good news for you.
We've already taken care of the statement, and in this lesson we are going to be looking a little bit
at the statement and then else if and else as well.
So else provides us an alternative.
If the condition isn't true, we can have additional statements and then also give us an option to provide
an additional condition and have different statements.
So just like this example here where we've got our if condition that we were working in the last lesson
and if we want it to output something, if this is not true, so we can basically say if this is true,
then we do this or else we do something else.
And we could also add to this by saying, if this is true, do this or else if this is true, do this,
or else if this is true, do this and we could go so on and so on.
And then lastly, we can have an alternative.
If none of those were true, then we have our last part of it where we've got our else.
So the statement executes and checks to see truthy conditions.
And if the condition is falsey and moves to the next statement that can be executed.
And then if we have an else that provides us an alternative output, if there is nothing that has been
true.
So we check to see if a number is greater than 10 and message accordingly.
And we also have a condition that if it's equal to an output, put in a message.
So that's the challenge for this lesson.
I'll give you a quick sneak peek where we're going to take and make use of if elusive and false statements.
And you can try it at first with just the if else.
And then also add in that if afterwards, that's that middle one.
So go ahead, pause the video and I'll work through this example coming up.
OK, had an opportunity to try this out.
So first of all, we need a number to work with.
How about we work with five since we've been working with that before, we need to check to see if the
number is greater than 10 and we know it's not greater than 10, but we'll output a message in the console.
And we've seen in the last lessons that, yes, we do update that number.
So Greater Ten and this is where we can utilize else.
So first we're going to output a message.
So what do you think is going to happen here and what are we going to see in the console when we refresh?
It was see, that was false.
If I change it to 15, refresh.
Yes, greater than 10.
So we also maybe one out of another condition to see what if it's equal to ten.
So if we have ten, then ten is not greater than ten.
So that's why we get this one as not showing up.
And that's false.
And so we're left with the false condition.
So we want to add one more and that's where we can do so else if and then we can apply the condition
and that same curly brackets to run the blockquote.
So in here we can say they are equal because that condition is true.
So let's try that out.
And of course, we do need to add in our condition.
So check them equal to and we can do an absolute make sure that it is equal to an absolute ten.
So they are equal.
So that also means that if you did a string value for ten, you're not going to see that and we're going
to get return back.
That was false.