02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoPrevious Video

Rational Operators

<p>We have seen the use of the <a href="/courses/video/7/58/Equality-Operators.html">equality operator</a> and how it is different from the assignment operator. Similarly, Rational Operators also compare two <a href="/courses/video/5/157/Using-Variables.html">variables</a> and give the result as a <a href="/courses/video/5/162/Boolean.html">Boolean</a> 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 &quot;<b>greater than symbol</b> &gt;&quot; and &quot;<b>less than symbol</b> &lt;.&quot; Likely you now understand what type of symbols we are referring to. We use the same &gt; and &lt; 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 &gt;= and &lt;=, referred as 'greater than or equal to' and 'less than or equal to' respectively.</p> <h2>(&gt;) Greater than Rational Operator</h2> <p>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 <b>trace(a&gt;b)</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: <b>trace(7&gt;3)</b>, since 7 is greater than 3, the output is given as true. For <b>trace(3&gt;7)</b>, the output would be false.</p> <h2>(&lt;) Less than Rational Operator</h2> <p>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 <b>trace(a&lt;b)</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 <b>trace(6&lt;7)</b> and <b>trace(5&lt;3)</b>, the result is true for the first one and false for the second one.</p> <h2>'Greater than or equal to'(&gt;=) and 'Less than or equal to' (&lt;=) Rational Operators</h2> <p>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 <b>equal to</b>' to the second value or not. In such a case we use the symbol &gt;=. Similarly, to check if the first value is either 'smaller than or <b>equal to</b>' the second value, we use the symbol &lt;= for that comparison. For example if we take <b>trace(6&gt;=5)</b>, the result would be true which meets the greater than <a href="/course/basics/conditionals-if">condition</a>. If we consider <b>trace(6&gt;=6)</b>, the result is still same (true) because it meets the equality condition. Same is the case for <b>trace(5&lt;=6)</b> and <b>trace(6&lt;=6)</b>, the result is true for both.</p>

Overview

What are operators and why do we need them to create programs. We'll discuss various types of operators and their uses later in this course

01:49

Default Values

To understand operators, we first need to understand how variables work -- mainly when it comes to default values and why they differ for various variable types.

06:41

Equality

In this video we will compare between equality and assignment and learn how to work with both. We also differentiate between the assignment operator (=) and the equality operator (==)

06:40

Rational Operators

In this video we will see how to check if a variable is: bigger, smaller, greater or equals, smaller or equals and so on..... using rational operators

05:52

From Rational to Boolean

All the operators we worked with so far returned in our trace panel a value of true or false. In this video we'll see that connection of our operators results to the Boolean data type as we explore

05:26

Equality Operators

So far we've seen how to compare and see if values differ or match but we did not have a way to ask if not. In this sample we'll look into the equality operator(make it a bit more complex)

05:59

Comparison Between Different Types

In the heart of programming is the capability to compare between things. In this video we talk about comparing between different variable data types.

04:15

Explicit Equality

Sometimes knowing if something is equal just isn't enough and we need to know if it is explicitly equal and that's where explicit equality operator comes in...

08:05

Logical Operator

Logical operators enable us to compare a few things at a time such as AND, OR and NOT. We will learn the syntax to represent these operators using few examples

09:52

There Are Many Ways To Say No

doing exactly the oposite of the logical logic seams crazy but actually its a very great way to get things done. Let us learn how to say no in terms of programming

04:15

Null vs. Undefined

Why are there two ways of saying nothing? I ponder that as well as I try to explain their roles. In the process, we will learn the syntax and its application in code

06:20