Home » Courses » Smooth Operator » Rational Operators ### Smooth Operator

1. Overview (01:49)
2. Default Values (06:41)
3. Equality (06:40)
4. Rational Operators (05:52)
5. From Rational to Boolean (05:26)
6. Equality Operators (05:59)
7. Comparison Between Different Types (04:15)
8. Explicit Equality (08:05)
9. Logical Operator (09:52)
10. There Are Many Ways To Say No (04:15)
11. Null vs. Undefined (06:20)

### Rational Operators

We have seen the use of the equality operator and how it is different from the assignment operator. Similarly, Rational Operators also compare two variables and give the result as a Boolean value (true or false.) For Rational Operators we use angular braces or you can say angle brackets or even corner braces. However, we usually to refer them as "greater than symbol >" and "less than symbol <." Likely you now understand what type of symbols we are referring to. We use the same > and < which we used in mathematics in our primary school. In addition there are also two more rational operators which are formed by combining these symbols with the = sign. They are >= and <=, referred as 'greater than or equal to' and 'less than or equal to' respectively.

## (>) Greater than Rational Operator

We use this operator to compare the two values or variables to check if one is greater than the other or not. The result is shown in Boolean values. For example, if we consider trace(a>b), the result will be true if 'a' is greater than 'b' and false if 'a' is either less than or equal to 'b'. One more example: trace(7>3), since 7 is greater than 3, the output is given as true. For trace(3>7), the output would be false.

## (<) Less than Rational Operator

This is same logic as the one above but reversed. The compiler here checks whether one value is less than the other or not. For example, if we take trace(a<b). the result is true if the value of a is less than b and false if it is equal to or greater than b. If we consider trace(6<7) and trace(5<3), the result is true for the first one and false for the second one.

## 'Greater than or equal to'(>=) and 'Less than or equal to' (<=) Rational Operators

We have seen how to compare and find whether the first value is less than the second value or greater than the second value. There are cases where we need to find whether the first value is either 'greater than or equal to' to the second value or not. In such a case we use the symbol >=. Similarly, to check if the first value is either 'smaller than or equal to' the second value, we use the symbol <= for that comparison. For example if we take trace(6>=5), the result would be true which meets the greater than condition. If we consider trace(6>=6), the result is still same (true) because it meets the equality condition. Same is the case for trace(5<=6) and trace(6<=6), the result is true for both. Got A Question?

### 'I love being Prime'

Have a question but don't want to ask it publicly? If you are a prime member just ask right here and we will get back to you within 48 hours. Not prime yet? no worries you can ask publicly below. ## Act now while we have available seating

Our on line school is private, affordable and interactive with trainer support.
Act now save your seat before someone else takes yours.