Welcome back, guys.
Welcome to another lecture here, are we going to continue working with operators, but is it going
to be something very interesting?
Now we're going to talk about Operator Precedent's and I'm going to create Muifa.
It's going to go see Dense.
Not just now.
I'm going to put a link in the description actually for you guys so you can go there and get the resource
that I'm going to show to you.
But before that, let's right.
Let's create another file called Proceedings.
And yeah, let's create another HTML file.
So I'm going to copy this from Control C, Control V, and I'm going to call Pressie.
That's very good.
So the HTML is not going to have all these.
All right.
But it's going to have what, Gristedes JSA and it's going to give me double JS now.
It's all good.
I'm just going to close this one.
I need these two only.
So and here I'm going to see.
Operators.
And I'm going to copy this one and I'm going to paste in here.
Very good.
Now, in order for this to work, slash precedent's.
That HDMI, right?
So here it is.
Now, this is the table that I'm talking about, but we're going to just go back here first.
What I want to do in the proceedings and I'm just going to see the wire, I'm going to create a variable
called current is very good in that current year will be 20-20 for me, for you can be different here
now
for date of birth for Rick is going to be nineteen eighty seven right here.
I want to check if is were in here.
We want to check if it's teenager.
So teenager.
Like Spirit, 16 years and a teenager, I think is between 13 and 19 years, right.
So we're going to we want to check if it's a teenager, if some boys, for example, me, is a teenager.
Now, I know that's a little bit confusing, but what we're going to do, we've got to create oi check.
Status or age?
And we're going to see Carinthia.
Minus date of birth of Rick, and I want to check if this is greater or equal to full age to each teenager.
Now, what will do this?
I'm just going to look at it and I will say check the status.
Now, when we talk about operators proceedings, we just want to see which of these operators consider
this as operator, these as separate operator and even people signees.
Operator, know what you think will be this one.
So it's true.
It returns.
True.
OK, so why is that?
So basically what we want to do here is logically we want this year, the current year 2020 and to be
minus this year, that the year that I'm born and after that to check if this is greater than a teenager
to return me a result.
So as you saw, it's going to return.
True.
Why this is happening is because 2020.
So they have but it's 1987 and here is greater than 16.
Right.
And that is why 2020 minus this one will give you 33, which is so these two will give you 33, which
is greater than teenager.
That's why it is going to give you that result.
So this is the age maybe is not a good example, but I want you to show you that there is an operator
precedent.
So first, this one is not executed first.
These two are executed.
Then this is compared to this one.
So I'm saying this.
If you go back to this table, so here is a Poseidon's in the following table is order from the highest.
I mean, this has the highest precedence and these are individual operators.
So if you put them in the brackets, for example, if you want this to go first, you're going to put
them in brackets and that's how it's going to work.
But now that's what we have here, is we have it's greater or equal to in minus.
Let's check where the minus is.
You need to go like this.
So we're going to here it is unary negation, that's how they call it.
And it's 17.
And where is a greater or equal to here?
It is greater than or equal.
So it's on 12.
So 17 is higher than 12.
That's why we did.
Yep.
Here it is.
So these all these all have a precedence or 17.
Don't be confused.
So that's why minus unary negation is more powerful than this.
Greater than or less than.
Right.
So even if we use less than the first will go for the minus.
That is why you need to check this table.
And now the last part is this equation.
I mean, assignment.
So that's why you check status.
It's giving us true or false because we are checking the status and we're checking the status.
And actually that is getting the value what is being calculated here.
So I hope I am.
You understand what I'm trying to say now.
Be careful, because if you do some operation, mathematical operation, wherever it is, make sure
that you are choosing things wisely because this is stronger than this.
And it will this part will be executed before this part.
Right.
So maybe some of you think, OK, this part will go first and after that it will compare it to the current
year.
It will be.
Yeah, it will be go minus with the company.
But that's not the case.
OK, that was a crazy example.
Now I'm just going to comment this one.
We're going to do another example.
For example, I'm going to say more first.
No second number
if I can type of.
Right.
Third number.
And that's it.
And yes, this is not correct.
Now I'm going to initialize all the clear values for them here.
First number, let's say, OK, I'm going to give it the 15 second number.
And it's good to have the space.
It's more it's not going to change anything, but it's good to have space.
Second number and third number.
Now, here, I will say five in here I will see twenty five.
Right.
Maybe I should go with 20 because I have five, five, five everywhere.
Now I have three numbers that have initial values inside.
Now what I want to do is I'm going to show you.
That.
We can use this one individual operators like this, so what I'm what I can do is I can say, OK.
For let's put a result here, here, I'm going to say a result.
The result is not actually holding any value, but it will hold in a minute.
Now, I just want third number to go minus first number.
And after that, I just want to do the least.
So third number is 20, minus five minus this.
The first number is going to give us a five year after that.
I want to delete by this second number.
Now, what do you think the result will be?
So let's alert and check the result.
So I'm just going to alert this result instead of a log.
But if you want, you can do calls a lot.
And it is why why it's won what you think is one.
Now, first, everything that is in this bracket, there is a precedence of 21 in here.
Inside there is a negation, how they call it negation in their negation.
So this will happen.
So 20 minus 15 will will be five.
And after that, these four deletion where it is, I'm just going to need to find out if it is the vision
is on the number of 15 and before was minus.
Right.
And everything is going under a like like that logic from this table, from this president.
So that is why you should look into that residence and everything will happen first in the brackets,
regardless of what is here, that will be second.
So even if we do
even if we do multiplication because multiplication and division, let's see, um, here it is.
Multiplication is from left to right.
Doesn't matter how you multiply in division, they're in the same place.
So it actually will be the result should be twenty minus 15 will be five times five.
Should I should get the result of twenty five.
It is the result is twenty five.
So I hope you get the logic of Operator Precedent's.
Let's do one more example where we are going to have a multiple variables and so I'm going to have first,
second, third, and I'm going to add fourth here and the fourth.
Will be how much like maybe six doesn't matter, we will see at the end now here I'm just going to common
these four actually we can common all of these and do it from scratch because I don't want to see any
alert box from previous.
Now, I just want it resolved to do something like this.
I would like to do again in brackets.
I would want to have a first number plus a third number, and we should have five here because everything
is like around it with fives.
So we have first number plus third number.
And after that we can have multiplication times for number.
Thumbs for no.
If we're going to minus again, this second number.
OK, so I think we use everyone first, second, third and fourth.
Now, I'm just going to go to alert and let's check out the result.
And I'm going to pause the video if you want, in order.
I'm just going to close here, just going to refresh.
So the number is 170.
So I'm going to pause the video and actually will leave you guys like five, four or not.
But we'll give you one minute to think about how I get this number.
OK, I hope you get this one right.
So because I've done it in that minute, I've just put it here.
The steps show these is when you put I didn't put resultantly.
So 15 is the first number, 20 is the third number times five, that minus five.
So actually we have second number and thought number to be five doesn't matter.
So the first step is everything to do in these areas, you know, or grouping operator.
So that is taking a first presidents and that's why it's coming out the thirty five.
So the second one is which one is it stronger at multiplication or minus.
So you see here that if you go down you will see that multiplication will take this one as first.
Sorry, guys, I just got a little bit confused, so it's not this one that we're just looking, it's
about the substraction.
So it's a fraction is a number 14, and that's why the multiplication is on level 15.
So forget about everything that I've told you about before.
So you should look, when it's come to mind, is this one substraction?
Right.
I just bought my video because I realize how come that I'm looking at this one negation here, you know,
negation.
And because I was I was I looked at that one and I was thinking, OK, that that is the minus, but
that is not the case.
So 17, it's not for that substraction it's 14.
Actually, that is why the result will be like this.
The first this will happen then because the multiplication is stronger than the minus.
It will happen that one thirty five times five and that is one hundred seventy five.
And after that we have the third step is this one hundred seventy five.
So the result, that's why the result that we have in here, we just passing there, it's 175, it goes
here.
That is the third and final step and that is why we have one hundred and seventy.
Now I hope you understand and this is about Operator Precedent's.
It's sometimes a little bit complicated to explain, but it's not that much.
Make sure you understand this table and don't just rush like me and think that this is the minus right
now.
The the highest, no more stronger precedent's, the lowest number like this one where this assignment
actually the result that is this part from left, from right to left.
So we're going to assign it that.
That's why that assignment happens last, because we are precedent's number three.
That is pretty much it for this lecture.
I hope you enjoy it.
Now, you know how these operate precedent's is working and you just practice it, find some other examples
here and just compare it divided and stuff like that.
Thank you very much.
I hope you enjoyed it.
And I will see you in the next one.