ActionScript tutorial  
  Home Computer Graphics Tutorials Tutorials Web Design tutorials Forums Computer Graphics Community Interview Interview Articles Articles Making Making About About US Contact us
 
*Home / Tutorials / Adobe Flash / ActionScript operator precedence
     
Maya tutorials   Autodesk Maya
Photoshop tutorials   Adobe Photoshop
Illustrator tutorials   Adobe Illustrator
flash tutorials   Adobe Flash
3Ds max tutorials   Autodesk 3D's Max
Premiere tutorials   Adobe Premiere
Dreamweaver tutorials   Adobe Dreamweaver
*
 

ActionScript operator precedence


Author: Animator
Level : Beginner
Environment : Adobe Flash MX Professional 2004
* * * * *
 
 

ActionScript Operator precedence

When two or more operators are used in a same expression , some operators take a precedence over other operators. The following table lists the operator precedence in ActionScript. Some rows in the table you may not think as operators. But they are used for altering the default precedence of the operator. For eg: parenthesis. Parenthesis raise the precedence of operators that are inside the parenthesis.

Highest
() .    
++ -- ~ !
* / %  
>> >>> <<  
> >= < <=
== !=    
&      
^      
|      
&&      
||      
= op=    
Lowest


As you can see from the table the parenthesis are having the highest precedence and the assignment operator is having the lowest precedence. That means always the operators inside the parenthesis will be executed first and the assignment operator will be executed the last. For eg:

10 * 2 + 2

evaluates to the value 22.

but if we are using parenthesis with this expression the result would change. For eg:

10 * (2+2)

evaluates to a value 40. Even though the + was having a lower precedence it evaluated first.
 
 
 
  Bookmark   Googlize this * Add to Yahoo * Add To_Delicious * Digg It * Scrutinize this * Spurl this * Furl * Socializer * Onlywire
     
  Discuss This   Add to Any * Add this * Blink It *
 
*

Home | Tutorials | Forums | Interviews | Articles | Making | About the Team | Terms and Conditions | Privacy Policy | Contact us
Copyright © 2006-2007 CGShelf.com. All Rights Reserved