Chaining if statements : if « Statement « Flash / Flex / ActionScript






Chaining if statements

 


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

        var greeting;
        
        var language = "english";
        
        if (language == "english") {
          greeting = "Hello";
        } else if (language == "japanese") {
          greeting = "Konnichiwa";
        } else if (language == "french") {
          greeting = "Bonjour";
        } else if (language == "german") {
          greeting = "Guten tag";
        } else {
        }
        
        trace(greeting);
    }
  }
}

        








Related examples in the same category

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