Welcome back.
We learned about arithmetic operators.
Now let's move to the second type of operators called comparison.
Those operators return a boolean either true or false.
For example we have this double equal sign.
Equal meaning equals two five.
Is it equal to five?
Yes.
The result would be true.
We have another comparison operator which is this exclamation mark followed by the equals sign.
This means that it's not equal to.
So five.
Is it not equal to three?
Yes.
So it's true.
This is the greater than sign.
Five.
Greater than three.
Yes.
It will return.
True.
The less than five.
Less than three.
It returns false.
Greater than or equal five.
Greater than or equal to five.
Yes.
True.
Return.
True.
And less than or equal five.
Less than or equal to six.
It returns true.
We have two variables x and y.
X equals to ten, y equals to 20.
Let's run this code and here we go.
For the first operation x is equal to y.
Know it returns false x doesn't equal to y.
Yes it returns true.
This is true x greater than y ten.
Greater than 20.
No it returns false x less than y.
It returns true.
So those are the comparison operators.
Let's move to the logical operators.
We have.
Uh, we have and or and not operators.
Those operators are used to combine conditional statements.
For example we have and meaning and x greater than five and y greater less than 30.
Yes.
True or x greater than five or y less than ten.
It returns true not reverses, not x greater than y.
It returns false.
And for better understanding, let me show you again guys, that x equals to ten and y equals to 20.
Copy it and let me paste it here again guys let me run this cell x equal to ten y equals to 20.
Print.
We have this expression.
It's of two parts x greater than five.
Yes it is true y less than 30.
Yes.
So true and true equals true.
So this true.
And this end operator evaluate between a true and a true it returns true.
Another example x greater than five.
Yes it's true or y less than 20.
No it's false but true or false returns true.
So this is the logic.
This is the logical operators.
True and true.
Returns.
True.
True or false.
Returns true.
True or true.
Returns true.
Not x greater than five.
X greater than five.
It's true, not the true.
It returns false.
So it reverses the result.
So and returns true if both statements are true.
So if this side and this side both statements are true, it returns true x greater than five and y less
than ten.
The or operator returns true if one of the statements is true, not reverses the result.
Returns false if the result is true.
So if it is true, it returns false.
Okay, so those are the basic operators that we're going to use in our course.
There are a lot of other operators but we are interested in those operators.