web design template

Page: 1 2

Equal (= =)

This operator is used to check for equality.

Syntax :
expression 1 = = expression 2.

Example:
a = "galaxy"
b = "galaxy"
if (a= = b)
{
trace ("galaxy means quality");
}
else
{
trace("sorry");
}

In the above example, both a and b are checked for equality and in the output window "galaxy means quality" will be displayed.

flash website templates

Modulo (%)
This operator returns the remainder of expression 1 and expression 2.

Syntax :
expression 1 % expression 2

Example :
on (press)
{
x = 4;
y = 2;
trace (x%y);
}

From the above example, the output window will show a result "0".


Not (Logical)

The operators invert the Boolean value of a variable or expression.

Syntax :
! (expression)

Example :
on (press)
{
galaxy = false;
if (! Galaxy)
{
trace ("don't worry");
}
}

On pressing, the button in the output window, the message "Don't worry" will appear.

Not Equal

Using this operator, the opposite of equality operator is tested.

If expression 1 is not equal to expression 2 it returns true.

Syntax :
expression 1 ! = expression 2

Example :
5 ! = 8 returns true
5 ! = 5 returns false.

flash website templates

Using this operator, the opposite of equality operator is tested.

If expression 1 is not equal to expression 2 it returns true.

Syntax:
Expression 1! = expression 2

Example:
5! = 8 returns true
5! = 5 returns false.

ADD (+)

Using the operator, any two expressions can be added.

Syntax :
expr 1 + expr 2

Example :
x = 2;
y = 2;
z = x + y ;

The output window will show a value "4".

Subtract (-)

Using this operator, any kind of subtraction or negating is possible.

Syntax :
expr 1 - expr 2

Example :
on (press)
{
trace (-(2+3) )
trace (2-3); trace (3.5-2.3);
}

The output window will show as -5, -1, 1.2

Multiplication (X)

Using this operator two numerical expressions can be multiplied. If both are integer, then result will be an integer. If both are floating, then result will be floating integer.

Syntax :
Expr 1 * expr 2

Example :

X = 2.0
Y - 3.0
Z = X * Y
Z = 6.0

X & Y are floating values and the result is also an floating value.

Division (/)

This operator is used to divide two expressions. The expressions and results are treated as floating numbers.

Syntax :
expr 1 / expr 2

Example :
x = 25/5
trace (x);

The output will show a value of 5.

Using this operator's numbers and strings can be tested. They are similar to comparison operators. The operators of string are

le, lt, gt, ge, eq, ne and add.

Syntax:
expr 1 (operator) expr 2

Example:
On (press)
{
trace (4 gt 3);
trace (3 add 4);
trace (4 lt 3);
trace (4 eq 4);
trace (4 ne 3);
trace (4 le 3);
}

The output window shows the values as true, 34, false, true, true, false. Hence the string operators can be used with strings and numbers.

And (Logical)

Used to validate two conditions.

Syntax :
expression 1 and expression 2.

Example:
if (name = = "Galaxy" and password = = "layout")
{
go to and stop (5)
}

The and operator checks for true in both the condition i.e. only if the two conditions are satisfied, it will execute the reset of the statement.

In the above example, both name and password should be correct to the original value, then reset statements will be executed, otherwise the loop will not execute.

OR (Logical)

If any one condition is true, then the operator will return true.

Syntax:
expression 1 or expression 2

Example :
if (name = = "Galaxy" or password = = "layout")
{
go to and stop (5);
}

if any one condition is true, then the statement will be executed. i.e. in the above example, either name or password should be correct and rest of the statements will be executed.

Regards,

Manoj Kotak.
The author is Director of Image Online Pvt. Ltd. developer of
Layout Galaxy web site design templates for photoshop and Flash.

All accompanying logos, brands and product names are trademarks of their respective companies.

Blood for humans comes only from humans : Donate Blood
http://www.donate-blood.org   E-mail - om@donate-blood.org




© Image Online  2001-2003