Okay.
So let's look at the logical operators.
And what are the logical operators.
So the logical operators are and or and not okay.
So these are the three logical operators.
Let me put them into one at a time.
This is the and operator.
This is the or operator.
And this is the Not operator.
So how can we now use those.
So let's say it's rainy but we have an umbrella.
Then we will just say we're protected.
So it's rainy I'm protected against rain okay.
But currently I'm not protected.
So how can I make sure that I get protected, that I will be protected well, therefore, I can just
add this end and here I'd say has umbrella.
So in case it is raining and I have an umbrella, I'm going to be protected.
So let's run this code again and see I'm protected against rain a okay so we're good.
And that is the end statement.
So now let's use the Or.
Operator.
And when would I not get wet.
So let's say I'm not getting wet.
So when would I not get wet either.
If I have an umbrella or it's not raining.
So here I'm going to say it's not raining.
So I'm adding this not exclamation mark.
So by using this exclamation mark in front of it, I'm basically negating whatever the value of that
bool is.
Okay, so let's add a breakpoint here and let's run our code.
And it gets to this point and I can hover over is rainy.
So it says is rainy is true.
Now if I hover over this exclamation mark it suddenly says is false.
This has umbrella is true.
So in this case, this entire statement here of the if statement is true, how do I now see if this
statement here is true or not?
Do you recall how we did it?
We marked it and then we used shift F9.
And by doing so we can see that this entire statement so not is not is rainy or has umbrella.
The combination of those two gives me a true statement.
So let's stop this.
And actually if we ran this without the debugger it says I'm not getting wet.
But that is currently because it doesn't matter whether it's rainy or not.
So this entire part would not matter at all because has umbrella is true.
So this entire statement here will be true either way.
So let's try this.
It says I'm not getting wet even though it is rainy.
That's because I have an umbrella.
But now let's set the umbrella to false and let's run it again.
And now it's not executing the code.
So it doesn't say I'm not getting wet.
So now let's say it is not raining.
So I'm saying this is going to be false.
Now let me run it again and I will see I'm not getting wet.
And why am I not getting wet even though I don't have an umbrella?
Because I don't have an umbrella with me.
That is because this statement here, even though is rainy, is set to false.
Now with the exclamation mark on top of that, it's negating the false into true.
So this statement here is turned to true, which then leads to this entire statement being true because
we're using this or in between.
So how can we make this even clearer.
So let me break it down here.
So if true on the left hand side and true on the right hand side, then the result will be true with
this or okay.
So let's say variants of or statements.
What other variants do we have.
So we have the variant of true and false.
And this will lead to true because either of the two is true which then leads to it being true.
So that's what the Or is for would really only cares whether one of the options is true.
Then it will be true.
And that's the difference to the end.
So we're going to see that in a second.
So if this one is false and the second one is true, it will still be true.
Now the fourth variant is this one is false and this one is false as well.
Then it will be false.
So the Or operator basically gives you a true statement only.
Only in one case, and that is if all the different variants.
So on the left and on the right hand side of the Or operator are false, then you get a false as a returned
value.
Okay.
So let's look at the and operator in the next video.