1
00:00:00,150 --> 00:00:01,750
I've got some good news for you.

2
00:00:01,770 --> 00:00:06,510
We've already taken care of the statement, and in this lesson we are going to be looking a little bit

3
00:00:06,510 --> 00:00:10,050
at the statement and then else if and else as well.

4
00:00:10,170 --> 00:00:12,570
So else provides us an alternative.

5
00:00:12,570 --> 00:00:19,650
If the condition isn't true, we can have additional statements and then also give us an option to provide

6
00:00:19,650 --> 00:00:22,380
an additional condition and have different statements.

7
00:00:22,560 --> 00:00:27,780
So just like this example here where we've got our if condition that we were working in the last lesson

8
00:00:27,990 --> 00:00:34,770
and if we want it to output something, if this is not true, so we can basically say if this is true,

9
00:00:34,950 --> 00:00:37,770
then we do this or else we do something else.

10
00:00:37,980 --> 00:00:45,180
And we could also add to this by saying, if this is true, do this or else if this is true, do this,

11
00:00:45,420 --> 00:00:49,950
or else if this is true, do this and we could go so on and so on.

12
00:00:50,070 --> 00:00:52,380
And then lastly, we can have an alternative.

13
00:00:52,500 --> 00:00:57,810
If none of those were true, then we have our last part of it where we've got our else.

14
00:00:58,080 --> 00:01:02,670
So the statement executes and checks to see truthy conditions.

15
00:01:02,820 --> 00:01:07,800
And if the condition is falsey and moves to the next statement that can be executed.

16
00:01:07,860 --> 00:01:14,730
And then if we have an else that provides us an alternative output, if there is nothing that has been

17
00:01:14,730 --> 00:01:15,150
true.

18
00:01:15,390 --> 00:01:20,850
So we check to see if a number is greater than 10 and message accordingly.

19
00:01:21,000 --> 00:01:26,870
And we also have a condition that if it's equal to an output, put in a message.

20
00:01:27,120 --> 00:01:29,220
So that's the challenge for this lesson.

21
00:01:29,370 --> 00:01:36,240
I'll give you a quick sneak peek where we're going to take and make use of if elusive and false statements.

22
00:01:36,450 --> 00:01:39,200
And you can try it at first with just the if else.

23
00:01:39,450 --> 00:01:43,240
And then also add in that if afterwards, that's that middle one.

24
00:01:43,440 --> 00:01:47,850
So go ahead, pause the video and I'll work through this example coming up.

25
00:01:48,070 --> 00:01:50,670
OK, had an opportunity to try this out.

26
00:01:50,850 --> 00:01:53,190
So first of all, we need a number to work with.

27
00:01:53,310 --> 00:01:59,040
How about we work with five since we've been working with that before, we need to check to see if the

28
00:01:59,040 --> 00:02:06,120
number is greater than 10 and we know it's not greater than 10, but we'll output a message in the console.

29
00:02:06,240 --> 00:02:10,410
And we've seen in the last lessons that, yes, we do update that number.

30
00:02:10,430 --> 00:02:15,480
So Greater Ten and this is where we can utilize else.

31
00:02:15,720 --> 00:02:18,210
So first we're going to output a message.

32
00:02:18,690 --> 00:02:22,680
So what do you think is going to happen here and what are we going to see in the console when we refresh?

33
00:02:22,680 --> 00:02:24,620
It was see, that was false.

34
00:02:24,870 --> 00:02:27,620
If I change it to 15, refresh.

35
00:02:27,630 --> 00:02:29,490
Yes, greater than 10.

36
00:02:29,850 --> 00:02:34,830
So we also maybe one out of another condition to see what if it's equal to ten.

37
00:02:35,640 --> 00:02:40,650
So if we have ten, then ten is not greater than ten.

38
00:02:40,890 --> 00:02:44,070
So that's why we get this one as not showing up.

39
00:02:44,070 --> 00:02:44,850
And that's false.

40
00:02:45,120 --> 00:02:47,310
And so we're left with the false condition.

41
00:02:47,520 --> 00:02:52,800
So we want to add one more and that's where we can do so else if and then we can apply the condition

42
00:02:52,920 --> 00:02:55,940
and that same curly brackets to run the blockquote.

43
00:02:55,950 --> 00:03:00,600
So in here we can say they are equal because that condition is true.

44
00:03:00,720 --> 00:03:01,650
So let's try that out.

45
00:03:01,890 --> 00:03:04,590
And of course, we do need to add in our condition.

46
00:03:04,710 --> 00:03:11,060
So check them equal to and we can do an absolute make sure that it is equal to an absolute ten.

47
00:03:11,250 --> 00:03:12,380
So they are equal.

48
00:03:12,390 --> 00:03:18,330
So that also means that if you did a string value for ten, you're not going to see that and we're going

49
00:03:18,330 --> 00:03:19,380
to get return back.

50
00:03:19,380 --> 00:03:20,040
That was false.
