1 00:00:00,840 --> 00:00:01,890 Welcome back everyone. 2 00:00:01,920 --> 00:00:07,170 All right there's one other type of statement that you can use and it's going to put a couple of times 3 00:00:07,230 --> 00:00:09,690 and I mean to type in else ifs. 4 00:00:09,840 --> 00:00:10,610 All right. 5 00:00:10,830 --> 00:00:14,070 And I'm going to go ahead and put it to Crilley brackets and there we go. 6 00:00:14,070 --> 00:00:17,490 Now the other thing you need to do is you don't need to make sure that these are touching like that. 7 00:00:17,490 --> 00:00:18,070 OK. 8 00:00:18,300 --> 00:00:23,720 And so we're going to do is there's only one other thing that we need to do. 9 00:00:23,730 --> 00:00:32,220 We need to type in two two brackets like this and we're going to say if cool number is double equal 10 00:00:32,460 --> 00:00:35,510 to to get any zero all the warnings disappear. 11 00:00:35,730 --> 00:00:38,830 And what I'll do is I'll just type in an alert. 12 00:00:39,420 --> 00:00:44,420 And just to see if this works here and we'll just type pop or something like that. 13 00:00:45,140 --> 00:00:45,430 OK. 14 00:00:45,500 --> 00:00:46,250 There you go. 15 00:00:46,580 --> 00:00:50,660 So if cool numbers equal to 2 This should just end up being an alert. 16 00:00:50,810 --> 00:00:51,240 OK. 17 00:00:51,280 --> 00:00:57,700 And if I put change the text here and you want to make sure that everything is working here. 18 00:00:57,700 --> 00:00:58,580 So there you go. 19 00:00:58,610 --> 00:00:59,160 And there we go. 20 00:00:59,180 --> 00:01:00,120 It works now. 21 00:01:00,170 --> 00:01:05,420 So the way this works is that this this again computers read lines like you read books line by line 22 00:01:05,450 --> 00:01:06,600 and they read every line. 23 00:01:06,800 --> 00:01:11,450 So what it does is that when this function is called and remember its function being called from this 24 00:01:11,490 --> 00:01:17,090 h T.M. here this function is called If Coola is equal to 1. 25 00:01:17,090 --> 00:01:18,760 It does this k. 26 00:01:19,130 --> 00:01:25,180 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. 27 00:01:25,250 --> 00:01:28,200 And this case number is equal to 2. 28 00:01:28,400 --> 00:01:33,860 And then we go ahead and run this code and if cool number is not equal to 2 it will run whatever's in 29 00:01:33,860 --> 00:01:34,730 the else statement. 30 00:01:34,730 --> 00:01:38,800 So if I just type in fun here you can see the statement is fired. 31 00:01:38,810 --> 00:01:39,210 OK. 32 00:01:39,350 --> 00:01:40,490 That's pretty much what it is here. 33 00:01:40,490 --> 00:01:44,990 Now the other thing is that you can't have two statements out of the same. 34 00:01:45,160 --> 00:01:48,250 OK so you can see that number two is equal to two. 35 00:01:48,250 --> 00:01:54,370 And then if you type something in differently here then it is going to throw an exception here. 36 00:01:54,420 --> 00:01:56,570 You notice how there isn't any warnings here. 37 00:01:56,600 --> 00:01:59,330 And the reason is that again javascript likes to make things work. 38 00:01:59,330 --> 00:02:00,440 It's actually quite awesome. 39 00:02:00,530 --> 00:02:06,410 But what you can do is you can see is equal to three and you can just type in something else here so 40 00:02:06,650 --> 00:02:08,050 cool numbers equal to three. 41 00:02:08,060 --> 00:02:13,460 And if I type something in here for example like this you can see that the whatever code was in the 42 00:02:13,460 --> 00:02:14,690 else if statement. 43 00:02:14,690 --> 00:02:17,840 The second one is fired here. 44 00:02:17,840 --> 00:02:24,980 So the order or the higher key as you will you will go from if to LCF to else. 45 00:02:24,980 --> 00:02:25,440 OK. 46 00:02:25,490 --> 00:02:26,990 And again it reads that line by line. 47 00:02:26,990 --> 00:02:31,730 Now when you're making your LCF statements it's best that you make them in any kind of logical order. 48 00:02:31,730 --> 00:02:34,520 So if you're doing things numerically like I've done here. 49 00:02:34,520 --> 00:02:40,470 So we have cool numbers equal to 1 then we do this if Khona else if cool numbers equal to two. 50 00:02:40,640 --> 00:02:43,660 Then we do this and LCF cool number is three. 51 00:02:43,670 --> 00:02:49,430 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 52 00:02:49,430 --> 00:02:51,990 it's actually quite easy to understand. 53 00:02:52,070 --> 00:02:52,580 OK. 54 00:02:52,670 --> 00:02:58,350 And of course you can have a ton of else if statements you can have 50 100. 55 00:02:58,370 --> 00:03:03,670 Now one thing about if statements is that there are a pretty important part of programming. 56 00:03:03,770 --> 00:03:07,720 However you don't want to rely on if statements only. 57 00:03:07,730 --> 00:03:13,430 So as you get become a better programmer you'll find better ways to do things other than if statements 58 00:03:13,430 --> 00:03:15,260 so you have an if statement. 59 00:03:15,260 --> 00:03:17,530 It's it works really well. 60 00:03:17,540 --> 00:03:21,590 I mean every program has an IF statement in there somewhere. 61 00:03:22,040 --> 00:03:25,770 But at the end of the day you want to eventually grow out of the statement. 62 00:03:25,850 --> 00:03:28,470 All right I'll see you guys in nice tutorial.