case statements

Top  Previous  Next

case statements

 

if selectorExpression matches the result of one of caseexprn expressions, the respective statement (or block) will be execute. Otherwise, elsestatement will be execute. Else part of case statement is optional. Different from Delphi, case statement in script doesn't need to use only ordinal values. You can use expressions of any type in both selector expression and case expression.

 

Examples:

 

case uppercase(Fruit) of

 'lime': ShowMessage('green');

 'orange': ShowMessage('orange');

 'apple': ShowMessage('red');

else

 ShowMessage('black');

end;