select keyword
select variable
case value1 then
instructions 1
case value2 then
instructions 2
...
case valuen then
instructions n
[else instructions]
end
:variable variable which value to be analyzed. : :value1, ..., valuen values of variable for which there are
appropriate instruction blocks instructions 1, ..., instructions n.
: :instructions block of valid instructions. :
Notes:
According to the Code Conventions for the Scilab Programming Language it is recommended:
For example, use:
A = 2
select A
case 1 then
`disp`_(1)
case 2 then
`disp`_(2)
else
`disp`_(3)
end
rather than
A = 2;select A case 1 then `disp`_(1); case 2 then `disp`_(2); else `disp`_(3); end
Warning: the number of characters used to define the body of any conditional instruction (if while for or select/case) must be limited to 16k.
while %t do
n=`round`_(10*`rand`_(1,1))
select n
case 0 then
`disp`_(0)
case 1 then
`disp`_(1)
else
break
end
end