Data Sheet

dScript
dScript User Manual v2.15
select case
The syntax for the select command is:
select <expression>
case <expression>
[statements]
case <expression1> to <expression2>
[statements]
case is <comparison operator> <expression>
[statements]
else
[statements]
endselect
When no case expressions match, the else statements are executed.
When more than one case expression matches, only the first matching block will be executed.
Control then passes to the instruction following the endselect command.
An example:
a = 4
select a
case 4
LedRed = on
case is > 3
LedGreen = on
case 1 to 7
LedBlue = on
endselect
Here, all three case expressions match, but only the Red LED will light up.
a = 4
select a
case 5
LedRed = on
case 1 to 3
LedGreen = on
else
LedBlue = on
endselect
Here, none of the case expressions match, so "else" bock will execute (the Blue LED lights up).
Copyright © 2016, Devantech Ltd.
All rights reserved.
www.robot-electronics.co.uk
28