Use conditional operator to set a default value for an undefined variable : Conditional operator : Language Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Language » Conditional operator »

 

Use conditional operator to set a default value for an undefined variable


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var weather:String;
        
        weather = weather ? weather : "partly cloudy";
        
        trace(weather);
    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Language
» Conditional operator