The next set of operators will look at are the relational operators, how do things relate together?
So here's another table.
So we have some relational operators that have various symbols which are probably familiar.
So we have a less than symbol which returns all of these.
Return a boolean result, true or false?
So the example that I have here is X less than three.
So if that's true, it's going to return true, otherwise return false.
And the X could be a literal the three could be a variable.
So it doesn't matter.
There's greater than less than or equal greater than or equal equals and not equals, and then something
that most other programming languages don't have is the identity equal and identity not equal.
So what this means, the equal is a double equals sign.
The identity equal is a triple equal sign.
And the identity, the regular equal sign says have X has the value of three.
It's true one JavaScript because of dynamic variables.
X could be a string three.
So quote three quote.
And that returns.
True, but the identity equal says they have to be a equal value and of the same type.
So quote three quote triple equal three is false.
So let's take a look at some examples of using the relational operators.
So once again, I've copied the starter program and let's just start by doing some comparisons.
So we'll start with the literal and we'll say we'll put a little message here is to less than three.
And also to less than three.
All right, so this should be true.
And that log
from.
So two less three is true, makes sense.
So let's come up with an operator and we'll say what upper one equals five and what appear to equals
seven.
So this replaces with opera one, an opera to.
And I'm just going to say no one worse than upward to.
And what I do hear Fred say was that
so again, true, so let's try a couple of the other operators.
So less than or equal should also be true.
Greater than should be false.
Greater than or equal should also be false.
Let's create an opera three and set it also to be five, what's to be the string five?
So
number three, opera three.
And it just changes around a little bit
of
everything look right.
So then we have offer one credit that up three and that comes out is false and that is correct because
it evaluates the number five.
And the string five is numbers, so it's not greater, but upper one is greater than or equal opportunity
that comes out is true because numerically it is true.
So then let's use the equal operator, so Castle, that log
is upper one, double equal to upper three
aspects and capsule's.
And we'll put in the identity one and the identity not equal and do the same thing over here.
I'm going to get a result I'm not expecting.
OK.
So are the same, yes, true, five and string five are the different false, but here the identity
equal becomes false and the not equal identity becomes true because they're not the same type.
So this is an introduction to the relationship.
We're going to find out a lot more about them when we get to conditionals and looping.
Next up, we're going to take a look at logical operators.