OK, so let's take a look at the logical operators.
This is mostly made up of the and or and not and these are just logic statements.
So if X is true and Y is true, then ending them together is also true.
If either X is true or Y is true, then using the order is true.
So they both have to be false in that case for that X or Y to be false.
So the end uses a double ampersand as its operator in the OR uses a double vertical bar and then the
not uses an exclamation point as an operator.
And it's unary.
So it just says if X is true, not X is false and vice versa.
So the immediate result of these is pretty simple, but you can have also very complicated expressions.
So let's take a look at some of that and never believe I did.
I made a copy of the starter sample application again.
I think I'll stop saying it.
So anyway, I did make a copy and we can do some logical operations here.
So let's start with just using booleans.
So if I say console log, true and true and let's come up with all the other possibilities
so that I can say true and false, I could say false and true and then
false and false.
This is kind of known as a truth table.
So what's the result?
True.
True, true.
And false.
False and true.
False and false.
Those are all the four possibilities.
Let's run that.
And only the first ones, true, because all of them have to be true and you're not limited just to
operators to operands, I can also say and true again.
And now I would have, I guess, nine possibilities, but we'll just list a couple of them.
Oh, just shake it up a little bit.
Now.
So you can have as many as you want.
You can say one plus two plus three plus four and go on for a long time.
Same thing with us, you can say true and true and true and true.
But with the end, all of them have to be true.
Now, if we switch the ends to wars, that's going to be a different example.
So let's see here.
Two wars.
All right.
I can probably do this to find a replacement such as oil for lines and will I come at these old.
Now, all of these are true, why?
Because there's at least one thing in each one of these that's true.
They can mix them up or is Anan's.
Know it's come at this hour,
so it's, uh.
Replace the first one and just say, you know, operator process takes effect here, the end has more
precedence than your first could do the first two first and then the order to the last one.
True, if true, because we have true and true is true, true or true, it is true.
Second one is false because true and false, false and false or false is also false.
The third one is true because the first part is false, but the second part with the other is true.
And same thing with the last part.
And that we could take all this and nodded and come up with the opposite result.
Let's come at these out
and because of our presidents, I'm going to want to put parentheses around this, so we're going to
start the whole thing and then I'll put the exclamation point here.
Otherwise, we just not the first one that I want to, not the entire statement.
The company at parentheses to the end of each of these.
OK, what's what's uncommented.
So you remember what it was.
So the first part is true, false, true, true, and now we have false, true, false, false.
So just reverse them.
Now, all this is very simple with literal boolean values, but then you can start mixing in the variables
and that starts complicating things.
So the first thing I could do is let's let's just borrow one of these.
Uh, maybe the first one.
Is that going to replace all this?
With variables
and say what true value equals, true, but false value equals false and then never have true, I can
just replace the with the variable.
So they want to falsify.
And so NASCAR took the variables instead of the literal, true and false, but we're going to come up
with the same result.
True, false, false, false, because it's an end and only the first one has Ultra's.
Now, to complicate things even further, let's come into South.
You can combine this with the relational operators and say something like this, and I'm not going to
get as complicated because we have lots of examples moving forward.
I to say let opper one equals five.
Let Opper two equals seven.
Let Opper three equals hello.
And then I can say something like this.
I can say if I say f sorry I'm getting out of myself.
Consider log opper.
One is less than five sorry for two or opper three
equals triple equals
hello with Litoral.
So this could be true because five is less than seven and three equals.
Hello.
So let's just run it real quick.
How about if we change this, to offer one is greater than OP or two and.
Opera three equals hello.
Well, the first parts can be false, but the second parts can be true.
So the entire thing is going to be false.
So these things can be combined in countless combinations.
So we're going to see a lot of examples moving forward, especially when we get the conditionals.
I already said the word F. So when we get the conditionals, we will see this used a lot more.
Next up, we'll look at the last operator we're going to look at, which is the assignment operator.