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

There Are Many Ways To Say No

In this video we'll take another look at working with not (!): so far we used our '!' operator while comparing variables. (a!=b). In this video we'll look at another way to work with negative equations in ActionScript - !(a==b)

After learning about AND (&&) and OR (||) operators, now it is time to understand what a NOT operator is. A NOT operator can be defined as the negation of any statement. Most of the math text books have the symbol (~) for the NOT operator, but in programming we use the exclamation mark (!) to denote the NOT logical operator.

NOT Operator (!) (Complement of a statement)

The NOT operator gives the complement of any statement when it is applied. For example, if we write trace(!true), the answer would be false because in terms of Boolean values, false is the compliment of true. This is the reason why a NOT symbol before an equality sign checks for explicit inequality (!==). As we get familiar with this operator, we'll understand how this operator is used in various forms. Here we'll list a few of these before moving to the next video.

Various Ways To Use NOT operator (!)

Firstly, we know that trace(!true) is false. But if we write trace(!true==false), this equation is split before giving the final result, trace(false==false) which is true of course. The same equation can be written like this as well, trace(!(false==true)). Here the result is same as the equation simplified to trace(!(false)) which gives the result as true. Consider another example trace(!(0)). We are using extra brackets just to avoid mixing up variables which may lead to confusion in big equations. This equation is converted to a Boolean form, trace(!(false)), since 0 is the value used for false. So the final result of trace(!0) is true.

NOT Operator (!) using Variables

There are a few important things to note while using the NOT Operator with variables. For example, take a variable isTrue which has a Boolean value 'true' assigned to it. We can write trace(!isTrue) to find the compliment of true which is false. But when we use isTrue further in the program, its value is not altered permanently due to changes made by the NOT Operator. The change is temporary for the particular line and the variable never loses its original assigned value. But if we want to change the value permanently, we must use the assignment operator along with NOT Operator. For instance, when we write isTrue = !isTrue, this will assign a value to the variable which is its compliment. In this case the value of trace(isTrue) changes from true to false.

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