All right, let's continue our logic implementation this way.
We left in the previous video.
You can see that we are asking our one condition is that if your age is less than 18 years, then you
will be allowed to enter.
But if your age is more than 18 years, then you be allowed to watch the movie.
So let me bring it back to 20 years.
Now, if I say that I have the console, yes, you qualify to watch the movie because now my age is
more than 18 years.
Okay, so now let's twist this a little bit.
Now, let me comment out this one.
And now let me have one more conditions here.
So now let's say the same movie scenario.
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
before 1881.
But 88 years I forgot how to write 18 and then let's the maximum maximum age is equal to.
30 years.
So condition number one.
If your age is less than 18 years.
18 years.
Then you.
Then you disqualify or then you are not.
Allowed to watch the movies.
The first condition.
The second condition is that if your age is more than.
More than the maximum.
Maximum age.
We will.
Say You are too old.
Please go and rest.
And then, if your age is not less than this or that, then you will see something.
Let's say if.
Your age.
Does not meet.
Any of the requirement.
Above.
Then we will say or disagree, we say.
You disqualified.
Okay.
So how can we implement this with code?
Let's see how you're going to do it.
So let's start with the first one.
If your age is less than 18 years, then you are not allowed to watch the movies.
Or let me change one.
If an age is more than if your age is more than.
Yeah.
18 years, then you are allowed to watch the movie.
But if your age is none of the above, then we can go home here.
So let's start with the first one.
First one is we are checking for Eve here.
If your age is more than 18 years, so let's declare a variable.
Quite a solution.
Let's, first of all, in this variable, the person attending.
So let person.
Or less person attending.
Speaker at least person attending.
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.
Okay.
So you're going to check let me have let me bring this one here so that you can compare.
I don't screw up, up, up over the now, you know our our question so here if the person attending
age.
If it is more than the minimum age.
Then our question is that you are allowed to watch the movie so you can copy this one here and come
down here and console.log.
Consume the clock and then display the message.
Now we see that you are allowed to watch the movies because now our first blog, quote, blog has run.
We have that.
All right.
Else.
Let's check for the another.
If it is more than the age 18 a your maximum.
If your age is more than the maximum age, meaning you're too old, right?
So here we can check for this.
We are checking for this one.
If your age is less than, is more than or equal to minimum, age is qualified.
But because you want your age to be exactly as the age of what you are requiring, so we can change
this one and make it less than or equal to.
You see, this one is no more.
Let's bring it back to before.
Yes, we have it.
So here.
Let's also check out if we can change.
We can add elseif elseif.
If on the other condition you add.
ElseIf.
Else if.
Person.
Attending age.
Is more than the maximum age.
You won't display something that you are too old.
You are too old.
Go and rest.
So let's console.log each year, console that log and say You are too old.
Go home.
Okay.
But what about that disco didn't run this one?
Because our age you provide it is not more than 20 or 30 years, so we don't have the this code being
run.
Lastly, if our age is less than what we are requiring, then we have ls so use ls to terminate the
entire the entire statement or display or return the result.
So here.
Meaning, if none of these ones is true, then the code down here is going to run.
So the same thing here.
If H does to meet any of the requirement about them, we will say you are disqualified.
So let me copy this message console dot log and say you want to see disqualified.
Now we have a complete application.
You get it?
So let's go back.
You see that because our person attending age is 20 years here.
Our age is more than 18 years.
So we are qualified to watch the movie.
But let's say my age is none of the above.
My age is ten years, so when I save it, which code block is going to run?
Is it this section or this section or this section?
Put this video and try and guess right.
So let's see.
I am saying that this code block will run.
Let's have a look.
So let me save it.
And now I told you disqualified.
Meaning you are not allowed to watch the movie.
What about if I provide age of 100 years?
We could block is going to run 100 years.
Is it more than minimum age?
Nope.
It's my age.
I tend more than maximum age.
Yes.
So here we run.
So let's have a look.
Let's save it.
And now you are allowed to watch the movies again because this one has run.
The person attending age indeed is more than minimum age.
So this code has run so in a condition that runs first.
The other runs will never run.
So how can we make this condition go here?
It is true that the person attending age is more than the minimum age.
So you will say that yes, you are allowed to watch the movie.
So how can you make this?
One could run unless we change this one to make it run, let's say for the meantime, just play around
with it.
So let's say if age is less than or equal to that, then this code would run here.
You are too old to you are too old.
Please go home.
So this basic logic that we can implement.
So remember we can change as if, as if, as if, as many level as we want.
And lastly, we bring else if none of these conditions meet.