IFELSE

Synopsis
IFELSE condition true.instructionlist false.instructionlist
Description

Command or operation where:

  • If condition evaluates to TRUE, then IFELSE runs true.instructionlist.

  • If condition evalutes to FALSE, then IFELSE runs false.instructionlist.

  • It is an error if condition does not evaluate to either TRUE or FALSE.

Example
; simple examples
IFELSE 1=1 [PRINT [Yes it is true]] [PRINT [No it is false]]
Yes it is true

IFELSE 1=0 [PRINT [Yes it is true]] [PRINT [No it is false]]
No it is false

; example where IFELSE outputs a value
TO MAX :a :b
  OUTPUT IFELSE :a > :b [:a] [:b]
END

SHOW MAX 1 2
2

SourceForge.net Logo