2 Replies Latest reply on Jan 30, 2012 1:56 PM by mr.mango97

    if, else and elseif commands

    mr.mango97

      So just for clarity of if, else and elseif....

       

      Lets say I have enetered a simple math equasion typed out in my program (see below)

       

      var a:iunt = 5;

      a = a + 5 * 2 + 20; //answer is 40

       

      I then could add an if and else statement (see below)

       

      if (a == 24) {

      trace ( "The Answer is 24" );

      }

       

      else {

      trace ("The Answer is not 24");

      }

       

      Where I get confused is the elseif statement. Btw is their a space between the word else and if? How do you write the elseif statement (what would the code look like if I wanted it to say "The answer is less than 50" and for that sentance to be true?