Assign value returned from a function to a variable : Return : Function Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Function » Return »

 

Assign value returned from a function to a variable


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var color:String = getColor();
        trace(color)// Displays: Red


    
    function getColor():String {
         var color:String = "Red";
         return color;
         color = "Blue";
         return color;
    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Function
» Return