Compound Assignment Operators (+=, -=, *=, /=, and %=) : Arithmetic Operators : Language Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Language » Arithmetic Operators »

 

Compound Assignment Operators (+=, -=, *=, /=, and %=)


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var x:Number = 0;
        
        x += 5// x = 5
        trace(x);
        
        x -= 3// x = 2
        trace(x);
        x *= 3// x = 6
        trace(x);
        x /= 2// x = 3
        trace(x);
        x %= 3// x = 0
        trace(x);
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Language
» Arithmetic Operators