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

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) and take a look at a new equality operator: the "is not equal": (!=).

In earlier videos, we came across all types of rational operators. But when we said equality operator, we just referred to (==). This is used to compare the equality of two variables and give the result. But there is another operator which is used to test the inequality of these two variables. This operator is referred as the "inequality operator" and the symbol to represent this operator is !=.

Test for Equality

Let us consider trace((a+b)==(c+5)), here a, b, c are the variables. a=5, b=6, c=-3. So the equation would result in trace(11==2), which is false. Hence, the application performs all mathematical operations before testing the equality of the equation. So == can be used to compare the equality for complicated equations as well.

Test for Inequality

This also works for inequality. We can check whether the first number is unequal to the second one or not. For example, if we have trace(a!=b), the output is true if the values of a and b are unequal and false if the values are equal. It is important to learn about this operator because we use the inequality condition in a few control statements for repetition of loops. As said earlier, detailed information about repetitive functions conditional statements will be provided later. This inequality operator can also be used to compare big and complicated equations. The application is good enough to first solve the equation on both sides and then compare the two sides to give out the Boolean result (true or false.)

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!

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