You are here: start » ppl » statements » if_then_else

IF ... THEN ... ELSE

IF ... THEN ... ELSE

Usage 1:

     IF (exp:boolean) statement ...

>> Evaluate "exp" and, if true, execute statement; otherwise skip to the next statement

Usage 2:

     IF (exp:boolean) THEN
       ...
     ELSEIF (exp2:boolean) THEN
       ...
     ELSE
       ...
     ENDIF

>> * `IF` - If expression cond is TRUE then this statement transfers control to the statement(s) following it, otherwise control is tranferred to the next ELSEIF, ELSE or ENDIF statement (requires THEN [or DO] after the condition)

* `ELSEIF` - (optional) If expression cond is TRUE then this statement transfers control to the statements following it, otherwise control is tranferred to the next ELSEIF, ELSE or ENDIF statement There may be multiple ELSEIF statements between the IF and ELSE statements (ELSE IF is a synonym; nothing is required to come after the condition, although THEN [or DO] may appear for clarification and consistency in the source code) * `ELSE` - (optional) Separates the false portion of an IF/ELSEIF statement from the true portion * `ENDIF` - Ends an IF/ELSEIF/ELSE statement block (END IF is a synonym) )

See also: While…EndWhile, For…Next