If Statements : if « Statement « Flash / Flex / ActionScript






If Statements

 

if (logical expression) {
   // code to execute if the expression is true
}

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

        var weather:String = "rain";
        
        if (weather == "rain") {
           trace("bringUmbrella");
        }

    }
  }
}

        








Related examples in the same category

1.Performing Actions Conditionally
2.If Statement with boolean constant
3.An if statement with no else
4.If statement with else
5.Chaining if statements
6.Performing Complex Conditional Testing