TeleFlow BasicScript IfThenElse
From TeleFlow
(Difference between revisions)
Wikilib (Talk | contribs)
(New page: Use the IF THEN ELSE END commands to perform conditionally a sequence of BasicScript statements.<br> <br> ===Syntax=== :IF <b><i>condition</i></b> THEN :[ELSEIF <b><i>condition</i></b>] :[...)
Next diff →
Current revision
Use the IF THEN ELSE END commands to perform conditionally a sequence of BasicScript statements.
Syntax
- IF condition THEN
- [ELSEIF condition]
- [ELSE]
- END
- condition: BasicScript commands or variable that result in a numeric value. If the value is zero, condition is said to have failed. If the value is not zero, conditionis said to have succeeded. The IF keyword is followed by a condition statement, and the THEN keyword. ELSEIF is used like a concatenation of ELSE and another IF and does not require its own END keyword.
Related Steps
Examples
BasicScript code
|
Result |
PRINT "start" @A = 1 IF @A = 1 THEN PRINT "Hello" ELSEIF @A = 2 THEN PRINT "WORLD" ELSE PRINT "Huh" END PRINT "end" |
start Hello end |
|
|
PRINT "start" @A = 2 IF @A = 1 THEN PRINT "Hello" ELSEIF @A = 2 THEN PRINT "WORLD" ELSE PRINT "Huh" END PRINT "end" |
start World end |
|
|
PRINT "start" @A = 3 IF @A = 1 THEN PRINT "Hello" ELSEIF @A = 2 THEN PRINT "WORLD" ELSE PRINT "Huh" END PRINT "end" |
start Huh end |
|
|
PRINT "start" @A = 3 IF @A = 1 THEN PRINT "Hello" ELSEIF @A = 2 THEN PRINT "WORLD" END PRINT "end" |
start end |
