1
00:00:00,180 --> 00:00:04,590
All right, let's continue our logic implementation this way.

2
00:00:04,590 --> 00:00:05,970
We left in the previous video.

3
00:00:06,000 --> 00:00:14,880
You can see that we are asking our one condition is that if your age is less than 18 years, then you

4
00:00:14,880 --> 00:00:16,320
will be allowed to enter.

5
00:00:16,320 --> 00:00:21,380
But if your age is more than 18 years, then you be allowed to watch the movie.

6
00:00:21,390 --> 00:00:24,210
So let me bring it back to 20 years.

7
00:00:24,420 --> 00:00:31,830
Now, if I say that I have the console, yes, you qualify to watch the movie because now my age is

8
00:00:31,830 --> 00:00:33,270
more than 18 years.

9
00:00:33,490 --> 00:00:36,120
Okay, so now let's twist this a little bit.

10
00:00:36,270 --> 00:00:38,610
Now, let me comment out this one.

11
00:00:39,210 --> 00:00:42,010
And now let me have one more conditions here.

12
00:00:42,030 --> 00:00:44,820
So now let's say the same movie scenario.

13
00:00:44,850 --> 00:00:55,950
Let's say let's and let's say minimum age is equal to let's say minimum age is equal to 18 years as

14
00:00:55,950 --> 00:00:57,420
before 1881.

15
00:00:57,420 --> 00:01:08,160
But 88 years I forgot how to write 18 and then let's the maximum maximum age is equal to.

16
00:01:09,320 --> 00:01:10,250
30 years.

17
00:01:10,820 --> 00:01:12,890
So condition number one.

18
00:01:14,690 --> 00:01:24,860
If your age is less than 18 years.

19
00:01:26,100 --> 00:01:27,210
18 years.

20
00:01:28,770 --> 00:01:31,260
Then you.

21
00:01:32,640 --> 00:01:36,330
Then you disqualify or then you are not.

22
00:01:37,250 --> 00:01:42,380
Allowed to watch the movies.

23
00:01:42,560 --> 00:01:43,820
The first condition.

24
00:01:44,090 --> 00:01:51,260
The second condition is that if your age is more than.

25
00:01:52,520 --> 00:01:55,580
More than the maximum.

26
00:01:57,020 --> 00:01:58,820
Maximum age.

27
00:02:01,950 --> 00:02:03,720
We will.

28
00:02:05,520 --> 00:02:10,289
Say You are too old.

29
00:02:10,680 --> 00:02:14,970
Please go and rest.

30
00:02:16,530 --> 00:02:23,500
And then, if your age is not less than this or that, then you will see something.

31
00:02:23,520 --> 00:02:24,690
Let's say if.

32
00:02:26,010 --> 00:02:27,630
Your age.

33
00:02:29,690 --> 00:02:32,450
Does not meet.

34
00:02:34,040 --> 00:02:37,370
Any of the requirement.

35
00:02:39,490 --> 00:02:40,420
Above.

36
00:02:40,600 --> 00:02:46,240
Then we will say or disagree, we say.

37
00:02:47,710 --> 00:02:49,630
You disqualified.

38
00:02:52,170 --> 00:02:52,680
Okay.

39
00:02:53,100 --> 00:02:55,440
So how can we implement this with code?

40
00:02:55,950 --> 00:02:57,390
Let's see how you're going to do it.

41
00:02:57,810 --> 00:02:59,840
So let's start with the first one.

42
00:02:59,850 --> 00:03:06,180
If your age is less than 18 years, then you are not allowed to watch the movies.

43
00:03:06,270 --> 00:03:08,310
Or let me change one.

44
00:03:08,580 --> 00:03:14,400
If an age is more than if your age is more than.

45
00:03:14,430 --> 00:03:14,890
Yeah.

46
00:03:15,910 --> 00:03:19,330
18 years, then you are allowed to watch the movie.

47
00:03:19,630 --> 00:03:23,440
But if your age is none of the above, then we can go home here.

48
00:03:23,530 --> 00:03:25,240
So let's start with the first one.

49
00:03:25,670 --> 00:03:28,510
First one is we are checking for Eve here.

50
00:03:29,260 --> 00:03:35,740
If your age is more than 18 years, so let's declare a variable.

51
00:03:36,040 --> 00:03:37,660
Quite a solution.

52
00:03:38,800 --> 00:03:42,520
Let's, first of all, in this variable, the person attending.

53
00:03:42,520 --> 00:03:45,070
So let person.

54
00:03:45,810 --> 00:03:48,810
Or less person attending.

55
00:03:50,580 --> 00:03:53,940
Speaker at least person attending.

56
00:03:53,990 --> 00:04:03,320
Age for short is equal to for now let's say the high school to 18 years or let me say 20 years for now.

57
00:04:04,190 --> 00:04:04,790
Okay.

58
00:04:05,000 --> 00:04:10,610
So you're going to check let me have let me bring this one here so that you can compare.

59
00:04:10,970 --> 00:04:20,149
I don't screw up, up, up over the now, you know our our question so here if the person attending

60
00:04:20,149 --> 00:04:20,899
age.

61
00:04:21,980 --> 00:04:26,120
If it is more than the minimum age.

62
00:04:27,110 --> 00:04:34,280
Then our question is that you are allowed to watch the movie so you can copy this one here and come

63
00:04:34,280 --> 00:04:37,550
down here and console.log.

64
00:04:39,120 --> 00:04:42,390
Consume the clock and then display the message.

65
00:04:42,660 --> 00:04:52,070
Now we see that you are allowed to watch the movies because now our first blog, quote, blog has run.

66
00:04:52,080 --> 00:04:53,250
We have that.

67
00:04:53,610 --> 00:04:54,360
All right.

68
00:04:54,840 --> 00:04:55,800
Else.

69
00:04:56,680 --> 00:04:58,560
Let's check for the another.

70
00:04:58,570 --> 00:05:04,330
If it is more than the age 18 a your maximum.

71
00:05:04,330 --> 00:05:08,380
If your age is more than the maximum age, meaning you're too old, right?

72
00:05:08,680 --> 00:05:11,560
So here we can check for this.

73
00:05:12,220 --> 00:05:13,240
We are checking for this one.

74
00:05:13,240 --> 00:05:22,150
If your age is less than, is more than or equal to minimum, age is qualified.

75
00:05:22,390 --> 00:05:30,190
But because you want your age to be exactly as the age of what you are requiring, so we can change

76
00:05:30,190 --> 00:05:33,640
this one and make it less than or equal to.

77
00:05:34,910 --> 00:05:36,600
You see, this one is no more.

78
00:05:36,630 --> 00:05:38,670
Let's bring it back to before.

79
00:05:38,700 --> 00:05:39,870
Yes, we have it.

80
00:05:39,870 --> 00:05:40,960
So here.

81
00:05:41,070 --> 00:05:44,910
Let's also check out if we can change.

82
00:05:44,910 --> 00:05:47,190
We can add elseif elseif.

83
00:05:47,190 --> 00:05:49,650
If on the other condition you add.

84
00:05:49,650 --> 00:05:50,490
ElseIf.

85
00:05:51,000 --> 00:05:52,050
Else if.

86
00:05:52,050 --> 00:05:53,160
Person.

87
00:05:54,090 --> 00:05:55,170
Person.

88
00:05:55,770 --> 00:05:57,450
Attending age.

89
00:05:58,340 --> 00:06:02,210
Is more than the maximum age.

90
00:06:03,070 --> 00:06:07,890
You won't display something that you are too old.

91
00:06:07,900 --> 00:06:08,900
You are too old.

92
00:06:08,920 --> 00:06:09,980
Go and rest.

93
00:06:10,000 --> 00:06:16,570
So let's console.log each year, console that log and say You are too old.

94
00:06:16,600 --> 00:06:17,440
Go home.

95
00:06:18,070 --> 00:06:18,700
Okay.

96
00:06:19,680 --> 00:06:23,160
But what about that disco didn't run this one?

97
00:06:23,160 --> 00:06:33,690
Because our age you provide it is not more than 20 or 30 years, so we don't have the this code being

98
00:06:33,690 --> 00:06:34,230
run.

99
00:06:34,800 --> 00:06:43,650
Lastly, if our age is less than what we are requiring, then we have ls so use ls to terminate the

100
00:06:43,650 --> 00:06:49,650
entire the entire statement or display or return the result.

101
00:06:49,650 --> 00:06:51,000
So here.

102
00:06:51,240 --> 00:06:58,050
Meaning, if none of these ones is true, then the code down here is going to run.

103
00:06:58,320 --> 00:06:59,670
So the same thing here.

104
00:06:59,670 --> 00:07:06,180
If H does to meet any of the requirement about them, we will say you are disqualified.

105
00:07:06,180 --> 00:07:14,040
So let me copy this message console dot log and say you want to see disqualified.

106
00:07:14,070 --> 00:07:17,820
Now we have a complete application.

107
00:07:18,450 --> 00:07:19,260
You get it?

108
00:07:19,530 --> 00:07:20,910
So let's go back.

109
00:07:20,910 --> 00:07:27,180
You see that because our person attending age is 20 years here.

110
00:07:27,180 --> 00:07:29,100
Our age is more than 18 years.

111
00:07:29,100 --> 00:07:31,650
So we are qualified to watch the movie.

112
00:07:32,040 --> 00:07:35,250
But let's say my age is none of the above.

113
00:07:35,430 --> 00:07:41,190
My age is ten years, so when I save it, which code block is going to run?

114
00:07:41,220 --> 00:07:45,450
Is it this section or this section or this section?

115
00:07:45,450 --> 00:07:48,300
Put this video and try and guess right.

116
00:07:48,300 --> 00:07:49,290
So let's see.

117
00:07:49,470 --> 00:07:54,540
I am saying that this code block will run.

118
00:07:54,870 --> 00:07:56,130
Let's have a look.

119
00:07:56,370 --> 00:07:58,680
So let me save it.

120
00:07:58,830 --> 00:08:01,800
And now I told you disqualified.

121
00:08:01,800 --> 00:08:04,110
Meaning you are not allowed to watch the movie.

122
00:08:04,740 --> 00:08:09,120
What about if I provide age of 100 years?

123
00:08:09,120 --> 00:08:12,840
We could block is going to run 100 years.

124
00:08:12,840 --> 00:08:14,550
Is it more than minimum age?

125
00:08:14,910 --> 00:08:15,540
Nope.

126
00:08:17,700 --> 00:08:19,500
It's my age.

127
00:08:19,500 --> 00:08:21,030
I tend more than maximum age.

128
00:08:21,030 --> 00:08:21,420
Yes.

129
00:08:21,420 --> 00:08:22,350
So here we run.

130
00:08:22,350 --> 00:08:23,640
So let's have a look.

131
00:08:23,640 --> 00:08:24,750
Let's save it.

132
00:08:25,230 --> 00:08:32,640
And now you are allowed to watch the movies again because this one has run.

133
00:08:32,640 --> 00:08:36,900
The person attending age indeed is more than minimum age.

134
00:08:36,900 --> 00:08:42,630
So this code has run so in a condition that runs first.

135
00:08:42,630 --> 00:08:44,970
The other runs will never run.

136
00:08:45,270 --> 00:08:48,390
So how can we make this condition go here?

137
00:08:48,390 --> 00:08:53,850
It is true that the person attending age is more than the minimum age.

138
00:08:53,850 --> 00:08:58,500
So you will say that yes, you are allowed to watch the movie.

139
00:08:58,500 --> 00:08:59,520
So how can you make this?

140
00:08:59,520 --> 00:09:06,150
One could run unless we change this one to make it run, let's say for the meantime, just play around

141
00:09:06,150 --> 00:09:06,420
with it.

142
00:09:06,420 --> 00:09:13,860
So let's say if age is less than or equal to that, then this code would run here.

143
00:09:14,490 --> 00:09:17,100
You are too old to you are too old.

144
00:09:17,100 --> 00:09:18,030
Please go home.

145
00:09:18,030 --> 00:09:21,690
So this basic logic that we can implement.

146
00:09:21,780 --> 00:09:28,140
So remember we can change as if, as if, as if, as many level as we want.

147
00:09:28,140 --> 00:09:33,360
And lastly, we bring else if none of these conditions meet.

