### Smooth Operator

1:05:13#### Prerequisite:

Coding Basics 2 ( ??? );**WARNING:**you did not complete all prerequisites of this course. To Complete prerequisites above, pass course Exam.

Variables helped us store information, making our first step in a world where a variable contains dynamic content. Operators are the tools we use to manipulate and test variables (data in general.) Operators are as common as they are critical in any programing language.

**What are operators?** Operators are used to perform various mathematical and logical operations on given data. The data that is subjected to various operations is supplied either directly as values or in the form of variables. There are various types of operators that perform different functions. For example, and - are arithmetic operators which are used to perform addition and subtraction respectively. Similarly, **Equality operators are used to compare a given set of values and Logical AS3 Operators are used to perform logical operations,** We'll discuss about these operators in deep as we proceed further.

## 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.

### Topics

- Overview (01:49)
- Default Values (06:41)
- Equality (06:40)
- Rational Operators (05:52)
- From Rational to Boolean (05:26)
- Equality Operators (05:59)
- Comparison Between Different Types (04:15)
- Explicit Equality (08:05)
- Logical Operator (09:52)
- There Are Many Ways To Say No (04:15)
- Null vs. Undefined (06:20)

## Operators, AS3 and Nothing

Before moving further, we should learn a new concept - nothing. In programing there are a few types of nothing and this is a critical thing to understand before starting to program. Nothing can mean literally nothing or it can mean a variable that has nothing in it. The first type of nothing that is an endless nothing is called undefined in programing while a defined nothing that is empty is usually refereed to as null. Don't worry if it's a bit confusing at first, as we have different examples to help you understand the concept of nothing. The next thing to notice is the inclusion of variables in this concept. Any new concept from now on will definitely include variables, so we'll see how various operations are performed on different types of variables and the significance of 'Nothing' on these variables.

## What are as3 operators?

Basically, in this hour we learn various types of operators including Equality, Rational, Boolean and Logical Operators. To conclude, there is detailed information about the concept of 'Nothing' and its usage in the program. So let's discuss each part one by one.

## Equality Operators

This is a concept which can be subdivided into two types: equality and inequality operators. Before learning about this, you must be aware of what Equality and Inequality means in the context of programming: it's when we want to check if a variables content contains something or doesn't.

Equality is the concept used to check the equality of two given values (or variables.) We use the comparison phenomenon to check the equality of variables. Similarly, inequality indicates whether the compared values are equal or unequal. In fact, the inequality between the two values is checked. This concept is very important in any programming language because it forms the core part of conditional statements. The conditional statement is when we ask the compiler to run a particular code based on a given condition. This is a very big concept and one of the most important topics, so you can expect detailed information in the upcoming videos. Hang in there as this is a more complicated topic: don't rush through this. If you really get this, you'll have a great foundation for many many years.

The equality operator is represented by ==. We use this operator to check the equality of any two values. For example, if we want to check whether a is equal to b, we can write **trace(a==b)** and the applications checks for the equality of the two. If both are equal then the result is given as true and if not then the result is false. (Here true and false are Boolean values).

Here most of the people mistake == with =. Please keep in mind, = is an assignment operator and is totally different from == which is an equality operator. Assigning a value to the variable is different than comparing two values for equality. For example, **trace(a=6)** assigns the value 6 to the variable 'a' and now a refers to 6. Whereas, **trace(a==6)** checks whether the value of a is equal to 6 or not. If yes, the result is given as true else false. The value of 'a' does not change when we use == operator, while it does if we use = operator. Focus is emphasized on this part so you can differentiate between the two. We advise you to practice the use of these operators before moving further.

The inequality operator is represented by the symbol !=. Unlike the equality operator, this operator checks for inequality of the given variables. For example, if we write **trace(a!=b)**, the compiler checks for inequality of the two variables and if they are unequal, the result is given as true or false (i.e if both are equal).

## Rational Operators

In the real world, knowing how to compare if something is equal or not isn't enough when we need to check if that something is larger or smaller: then we need to use one of the rational operators. For instance, if we want to check whether one value is less than or greater than the other, we cannot use the == operator. Here we make use of Rational Operators. Different types of rational operators are represented by the symbols **<,>,<=,>=**. We use corner braces or angular braces to represent these operators.

- < symbol is "less than": used to check whether a value is less than another (
**a<b**checks to see if a is less then b) - > symbol is "greater than": used to check whether a value is greater than another (
**a>b**checks to see if a is grater then b) - <= symbol is "less than or equal to": used to check whether a value is either equal to or less than another (
**a <= b**checks to see if a is less than or equal to b.) - >= symbol is "greater than or equal to": used to check whether a value is either equal to or greater (
**a <= b**checks to see if a is greater than or equal to b)

## Boolean and Logical Operators as3

Since Rational as3 Operators use Boolean values for the output, we can change from Rational to Boolean with ease. We can assign a Boolean value to a variable and check for Boolean equality and inequality in terms of true or false.

You must have noticed by now that are operators are a huge topic: there are many types of as3 operators. Logical Operators are used when we want to compare two statements or equations simultaneously. There are two types of Logical Operatorss:

- AND Logical Operator is represented by the code &&. This is used when we want to check if all the equations being compared are true. For example, trace(a<b && b>c) gives true only if both a<b and b>c, and gives false in all other cases.
- OR Logical Operator is represented by the symbol ||. This is used to check whether any equations being compared are true, or all are true. For example, trace(a>b || b>c) gives true if at least one of the two is true or both are true. This gives false only when both the equations are false.

## Explicit Equality, NOT, Nothing, Default Values, null and Undefined

Explicit Equality and inequality in a comparison means the values are exactly equal or unequal. Explicit Equality is represented by the symbol ===. For example, we know true in Boolean form is equal to 1 but not exactly equal to 1: true is Boolean, 1 is Number. Therefore, if we write **trace(true===1)**, the result is false whereas it is true for trace(true=1). It's the same case for inequality which is represented by the symbol !== and demands explicit inequality.

There is another operator in programming used for the complement of a value: NOT. The NOT operator is represented by the symbol !. If we consider **trace(!false)**, the result would be true and vice versa.

As we said earlier, 'Nothing' is having no data. There are two types in this regard. When we declare a variable along with its data type and don't assign a value to it (**var isLoaded;**), the variable is empty but occupies memory : because the data type was not declared, a default value can not be stored in that variable. Here, the compiler assigns default value undefined to the variable. If we trace out the variable, we can see the output is undefined. With that said we do have a defined variable only its content is not defined. (On the other hand another type of nothing is no variable as well or null(absolute nothing).

If we declare a variable without a data type, there is no memory saved for it. Such a variable is considered as an **undefined variable**. Both null and undefined are equal, but to compare them, they must be in the form of variables %u2013 else Flash generates a warning during compilation.

However, if we try to check for explicit equality of null and undefined, we find both are explicitly unequal (null===undefined). The result would be true if we used explicit inequality.

Now after this overview it's time for you to jump right in and learn "what the as3 operators are": this is a fun class as well as extremely informative, something you'll use throughout your career.

Our free content is sponsored by these ads become a prime member and get rid of them.

Source Test Your

Skills

## 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.