Now I'm on a hunch about the X or are logical OPERATOR OK.
So X or.
OK.
So as you can see here in order to actually use the x or logical operator in your code you actually
need to press the shift plus the number 6 on your keyboard.
And design is the sign for X or are logical operator when you want to actually use this logical operator
in your code.
OK.
Now let me actually explain what this actually logical operator does.
The x or convention has one logical operator.
This is the logical operator OK.
And this results in a true value only if the boolean expressions it combines have opposite values.
Ok if both are true or both are false they X or are logical operator produces a false value.
OK so now let me actually show you some real examples to make this concept more clear for you.
OK.
So for example I want to create another variable here and that is the type of my variable is it and
the name of my variable is for example number 1.
OK.
And I want to assign a value to my variable.
For example 59.
And then at the end of my statement I need to put in a semicolon.
OK.
So and here I want to actually create another variable of it a boolean data type so boolean and the
name of my variable would be Chan boy home.
OK.
And then I can assign a value to my variable for example fonts and an idea of my statement.
I need to put in a semi-colon OK.
So now I want to actually output the value of these can by valuable to the council system that out that
print line and then inside the prentices I just need to refer to the name of my variable can by home.
OK.
And then at the end of my statement I ended up with a semi-colon.
So if I run my project now as you can see it's going to output this value to the concert OK.
Disvalue is the value of this trend by home variable.
Ok so now let me actually comment out this line of code here and I want to change the value of my hand
by home variable.
So I just need to revert to the name of my variable can by home.
And then I can actually assign a combination of expressions to my variable.
So the first expression would be Nahm one must be less than or equal to 50.
OK.
And then I use the x or logical operator as you can see here.
OK.
And again I create another expression here.
Now I'm fun must be greater than 40.
OK.
And then at the end of my statement I need to put in a semi-colon OK.
So now if I want to output the value of my variable to the console I just need to type in here and system
that out that princeling.
And then inside the apprentice's I need to refer to the name of my ABOUT can by home.
And then at the end of my statement I need to put in a semi-colon.
So if I run my project as you can see it's going to output this value to the council OK.
So let me ask you to explain once again that what this logical operator does.
OK.
So this logical operator results in a true value only if the boolean expressions it combines have opposite
values.
So as you can see here these expressions are boolean expressions.
OK we call these expressions boolean expressions because these expressions actually return a boolean
value.
True or false.
OK so we call them boolean expressions.
So this logical operator actually results in a true value only if the boolean expression is.
It combines have opposite values.
So as you can see here this expression here evaluates to false.
Why.
Because the value of the noun number one variable is greater than number.
Fretty as you can see here 59 is greater than number 40.
Ok but in this expression I am telling the computer that the value of the now one variable must be less
than or equal to number 30 in order to evaluate this expression to true.
And in this expression I am telling the computer that the value of the number one variable must be greater
than 40 in order to evaluate this expression to true.
So as you can see here this expression evaluates to TRUE Why.
Because the value of the novel non-valid valuable is greater than 40.
The value of the number one variable is fifty nine.
OK so fifty nine is greater than 40.
So this expression evaluates to true logical operator results in a truth value only if the boolean expressions
it combines have opposite values.
OK.
So as you can see here the value of this expression evaluates to false.
OK.
And the value of this expression evaluates to true.
So this logical operator results in a true value.
Why.
Because the boolean expressions that this logical operator combines have opposite values.
OK.
So this expression here evaluates to false and this expression here evaluates to true.
So the entire expression evaluates to TRUE.
Why.
Because I am using this logical operator here.
OK so this expression evaluates to false and this expression evaluates to TRUE.
OK.
So the entire expression evaluates to TRUE.
Why.
Because this operator here results in a true value only if the boolean expression is that it combines
have opposite values.
OK so these boolean expressions have opposite values.
OK.
So as you can see in the console the true value is now actually out with a to the console like so.
Now if I for example change this value to something else for example 59 as you can see now this expression
evaluates to TRUE.
Why.
Because the value of the number one variable is now equal to that to this number here.
OK.
The value of this number one variable is now equal to this number here.
OK 59.
So now if I run my project now it's going to actually be out with the false value to the console as
you can see here.
OK this value is the value of this variable here.
OK.
Why is it actually out with had the false value to the console.
Because this logical operator here results in a true value only if the boolean expressions it combines
have opposite values.
Ok if both are true or both are false this logical operator here produces a false value.
OK.
So as you can see here both of these expressions here actually evaluates to true so.
So the entire expression evaluates to false and that false value is assigned to this variable here.
And as you can see here in the console this false value is now out with to the console.
OK so now let me actually explain to you what's going on here in line 42.
I created a variable.
Now what.
OK the data type of my variable is int and then I assigned a value to my variable number 59.
OK.
And in line 43 I created another variable with the boolean data type and I gave a name to my variable.
For example can buy home OK.
And I assigned a value to my valuable for example fots.
OK.
And in line 47 as you can see here I decided to change the value of my boolean variable.
So I just referred to the name of my variable and then I actually put a combination of expressions here
in order to actually assign the value of the entire expression to my variable.
OK.
So as you can see here the first expression here evaluates to TRUE.
OK now one is less than or equal to the number 59.
So the value of the number one variable is 59 and this number is 59.
So this expression evaluates to TRUE.
OK.
And then I am using the logical operator as you can see.
And then this expression again evaluates to true because the value of this non-valid valuable is greater
than 40.
OK.
As you can see 59 is greater than 40.
So this expression now evaluates to true so.
So this operator results in a true value only if the boolean expression is.
It combines have opposite values.
So for example if I want to actually evaluate the entire expression through this expression here for
example must evaluate to true.
And this expression here must evaluate to false.
OK.
Or this expression here must evaluate to false.
And this expression here must evaluate to true.
OK this logical operator here results in true value only if the boolean expressions these are the boolean
expressions only if the boolean expressions it combines have opposite values.
OK so this is very important.