Logical query letters are used to determine the relationship between more than one variable. And if we want to check more than one condition. So for example, here we have two variables. The first one is called, is an employee, and it's a Boolean, and it's true. And another variable called teen years experience. And it's also true.
And suppose that we have a person or an employee who has these conditions and we need to check if that person is still an employee is still an employee, and he has or she has more than 10 years of experience. So it's so simple I you I would just use console and then log and then I would just type is an employee and I would type double ends And what double end means is that it means we need to check if the first variable is true. If the first variable is true, we will go ahead and check the other variable and determine the result. So here I'm going to try 10 years experience. And if I save and Iran, I get through, because the first condition or the first variable is true, and the other variable the second variable is also true, but suppose that 10 years of experience is False.
False, and that person does not have a 10 years of experience. So in this condition, if I save and run our program, I get false, because one of these variables is false. And, and, and this these two samples meaning means that if one of these variables is false, the entire expression We'll be false as well. Another logical operator which is called or, and or has a sample of two straight lines. And the and now we have or and what it does is that it checks only if one of them is true. And if one of them is true, we will the complete expression will be true.
For example, if I save and run, I will get through because is an employee is too but the 10 years of experience is false but we only need we only need one variable to be true for the for the complete expression to be true. But if for example, is an employee, this person is not an employee is no longer an employee, and this is false. And if I save and run, I will get false because neither of these variables All of these variables is true. Sometimes you want to do the reverse. So for example, we want to check if a variable is not true. So I would add exclamation mark before the variable.
And I would also add here exclamation mark before the value. And what that means is that this variable is false if that variable is false, and if that variable is false, or the other variable is false, we will get through and as you can see, we get through because here we are checking if one of these is false and both of them are false, but if only one is false, we will also get true because we are checking for only one variable. On the other hand, if we use and again, but we want to check if a variable is false, for example, the first one is false. And that is true because here it says, Is it false? And yes, it's false. If, if both of them are false, I will get false.
If I save and run, I get false because only one is false, but the other one here says true. On the other hand, if I use the and again the AND operator again, and I make the first one, false, and the second one, false, so now we are checking if both of them are false. And yes, both of them are false. So if I save and run, I will get through because both of them, both values are false. But if only one variable is false, and if I save and run I get false, because one variable is false and that is true, one variable is false, and the other variable is not false. It's true here, but the actual value is false.
So we will get false So to recap, and operator is used to check if both variables or both expressions have the same value and if that is true, we will get through. If that is false we will get false. On the other hand, we only need one variable to be true for the, for the complete expression to be true. All we want we only want one variable to be false for the complete expression to be false