Passing Parameters by Value or by Reference : Function parameters : Function Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Function » Function parameters »

 

Passing Parameters by Value or by Reference


 


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var myVariable:Number = 5;
        var myVariablePlusOne:Number = incrementByOne(myVariable);
        trace(myVariable);
        trace(myVariablePlusOne);

    }
    function incrementByOne(nValue:Number):Number{
        nValue++;
        return nValue;
     }

  }
}
// 5
// 6

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Function
» Function parameters