Logical Operators

5 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$39.99
List Price:  $79.99
You save:  $40
€34.21
List Price:  €68.43
You save:  €34.22
£29.66
List Price:  £59.33
You save:  £29.67
CA$55.16
List Price:  CA$110.35
You save:  CA$55.18
A$61.10
List Price:  A$122.22
You save:  A$61.12
S$51.46
List Price:  S$102.93
You save:  S$51.47
HK$312.03
List Price:  HK$624.14
You save:  HK$312.11
CHF 32.11
List Price:  CHF 64.24
You save:  CHF 32.12
NOK kr401.67
List Price:  NOK kr803.45
You save:  NOK kr401.77
DKK kr255.41
List Price:  DKK kr510.89
You save:  DKK kr255.47
NZ$68.04
List Price:  NZ$136.11
You save:  NZ$68.06
د.إ146.86
List Price:  د.إ293.76
You save:  د.إ146.90
৳4,868.14
List Price:  ৳9,737.51
You save:  ৳4,869.36
₹3,529.50
List Price:  ₹7,059.88
You save:  ₹3,530.38
RM168.90
List Price:  RM337.86
You save:  RM168.95
₦61,122.31
List Price:  ₦122,259.91
You save:  ₦61,137.60
₨11,352.43
List Price:  ₨22,707.71
You save:  ₨11,355.27
฿1,287.39
List Price:  ฿2,575.11
You save:  ฿1,287.72
₺1,649.77
List Price:  ₺3,299.95
You save:  ₺1,650.18
B$217.85
List Price:  B$435.76
You save:  B$217.91
R707.27
List Price:  R1,414.71
You save:  R707.44
Лв66.98
List Price:  Лв133.98
You save:  Лв67
₩55,593.84
List Price:  ₩111,201.58
You save:  ₩55,607.74
₪133.56
List Price:  ₪267.16
You save:  ₪133.59
₱2,275.61
List Price:  ₱4,551.79
You save:  ₱2,276.18
¥5,925.49
List Price:  ¥11,852.46
You save:  ¥5,926.97
MX$746.88
List Price:  MX$1,493.95
You save:  MX$747.07
QR145.59
List Price:  QR291.22
You save:  QR145.63
P575.58
List Price:  P1,151.30
You save:  P575.72
KSh5,166.70
List Price:  KSh10,334.70
You save:  KSh5,168
E£1,941.52
List Price:  E£3,883.53
You save:  E£1,942
ብር5,721.79
List Price:  ብር11,445.02
You save:  ብር5,723.22
Kz36,469.08
List Price:  Kz72,947.28
You save:  Kz36,478.20
CLP$38,879.87
List Price:  CLP$77,769.47
You save:  CLP$38,889.60
CN¥285.16
List Price:  CN¥570.39
You save:  CN¥285.23
RD$2,535.76
List Price:  RD$5,072.16
You save:  RD$2,536.40
DA5,193.23
List Price:  DA10,387.77
You save:  DA5,194.53
FJ$90.23
List Price:  FJ$180.48
You save:  FJ$90.25
Q306.89
List Price:  Q613.87
You save:  Q306.97
GY$8,368.31
List Price:  GY$16,738.73
You save:  GY$8,370.41
ISK kr4,899.57
List Price:  ISK kr9,800.37
You save:  ISK kr4,900.80
DH362.96
List Price:  DH726.02
You save:  DH363.06
L670.43
List Price:  L1,341.04
You save:  L670.60
ден2,112.24
List Price:  ден4,225.01
You save:  ден2,112.77
MOP$321.36
List Price:  MOP$642.81
You save:  MOP$321.44
N$709.42
List Price:  N$1,419.02
You save:  N$709.60
C$1,471.90
List Price:  C$2,944.18
You save:  C$1,472.27
रु5,637.55
List Price:  रु11,276.52
You save:  रु5,638.96
S/140.86
List Price:  S/281.76
You save:  S/140.90
K169.50
List Price:  K339.04
You save:  K169.54
SAR150.04
List Price:  SAR300.13
You save:  SAR150.08
ZK951.86
List Price:  ZK1,903.96
You save:  ZK952.10
L173.78
List Price:  L347.61
You save:  L173.82
Kč835.99
List Price:  Kč1,672.19
You save:  Kč836.19
Ft13,444.53
List Price:  Ft26,892.42
You save:  Ft13,447.89
SEK kr376.32
List Price:  SEK kr752.74
You save:  SEK kr376.41
ARS$54,486.61
List Price:  ARS$108,986.84
You save:  ARS$54,500.23
Bs276.50
List Price:  Bs553.08
You save:  Bs276.57
COP$159,741.91
List Price:  COP$319,523.76
You save:  COP$159,781.85
₡20,221.55
List Price:  ₡40,448.16
You save:  ₡20,226.60
L1,047.97
List Price:  L2,096.21
You save:  L1,048.24
₲288,326.82
List Price:  ₲576,725.74
You save:  ₲288,398.92
$U1,602.41
List Price:  $U3,205.22
You save:  $U1,602.81
zł145.54
List Price:  zł291.13
You save:  zł145.58
Already have an account? Log In

Transcript

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

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.