# if, then, elseif, else, endif

Conditional branching

## 1) Format 1

    if <expression> <statement>

### Remarks

Executes a <statement>, if <expression> is true(non-zero).

### Example

    ; If A>1, jump to ':label'.
    if A>1 goto label

    ; If result<>0, assign 0 to A.
    if result A=0

## 2) Format 2

    if <expression 1> then
      ...
      (Statements for the case:  <expression 1> is true (non-zero).)
      ...
    [elseif <expression 2> then]
      ...
      (Statements for the case:  <expression 1> is false (zero) and <expression 2> is true.)
      ...
    [elseif <expression N> then]
      ...
      (Statements for the case:  <expression 1>, <expression 2>,... and <expression N-1> are all false, and <expression N> is true.)
      ...
    [else]
      ...
      (Statements for the case:  all the conditions above are false (zero).)
      ...
    endif

### Remarks

'if' and 'elseif' statements must end with 'then'.
'elseif' and 'else' can be omitted.
'endif' can not be omitted.

### Example

    if a=1 then
      b = 1
      c = 2
      d = 3
    endif

    if i<0 then
      i=0
    else
      i=i+1
    endif

    if i=1 then
      c = '1'
    elseif i=2 then
      c = '2'
    elseif i=3 then
      c = '3'
    else
      c = '?'
    endif

## Reference

Expressions and operators