Some more operators, we have unary operators, so let's say we have Vergès equals nine.
How would I change Vare, let's have I equal to minus nine?
Well, your first instinct is to go minus nine, but if there's a relationship between G and I, we
would say you can just have minus G as the negative version of G.
Now that little minus in front is called a unary operator performs an operation on one thing, which
is in this case, G.
You can of course just have that totally alone as minus G.
Now, that doesn't replace gas, always nine minus G is just used in its own context.
So that's a unary operator.
What else have we got?
We've got a compound operator.
If I want to add one to I, for example, I could say I equals I plus one.
Seems straightforward, so we take the old version of I add one to it and then put it back into I,
but as a shorthand way of doing it, and that's plus equals one.
So what it do is recognize that plus equals wants you to take I and then add whatever number you've
put on the right hand side to I.
Same works in reverse ie minus equals one.
So if we run all this we should come back to the answer of minus nine.
So minus eight and we come back to minus nine.
Simple enough, what else have we got here?
We got logic, logic, logic, logic.
So.
You wouldn't have this statement sitting alone I equals equals g for a start, you'd use it to check
something.
In this case it's checking if I is equal to G and when it says equal to it means exactly.
Number one, is it an integer?
Number two, is it the same value.
You've got to be careful when you're checking if things are equal because if you have a double that's
a nine and you have an integer that's a nine.
In some languages they're equal.
In other languages, they're not in JavaScript.
If you have an integer nine and a string nine and use two equals, they'll be equal.
But if you use three equals, they will not be equal because they are different types.
So you've got to be careful with comparison strings and always check, always, always check that the
comparison is what you expect it to be.
So let's move on with some more comparison operators.
Let's have I not equal to.
So if I is not equal to G, this will return true.
If it is equal to G, it will return false as in it's the reverse of this first one and then we have
a whole bunch of others.
I is less than g we have I is more than G.
I is less than or equal to G.
And can you guess the last one is greater than or equal to G.
So these last to include the value that that's the flipping point of that statement, these two don't
include it, so.
If I was one and she was one, that's not true, that's not true, that is true.
And that's true.
And that's true because we also have equals as part of those greater than or less than statements or
logic operators.
OK, now we have what else do we have here?
Oh, I have a little example for you.
That's Havar equals true.
So this is a boolean.
It's either true or false.
If I want to print the opposite statement of E, I would have print not e exclamation mark means not.
So if we run that, we should get a printed force and we do.
Okay, so those cover a whole bunch of operators.
Let's grab your homework.
Oh, you're in luck.
There is no homework this time.
Congratulations.