The switch statement selects the processing according to the result of the expression. The expression is specified within parentheses.
The switch statement can contain case labels and a default label, which are options of processing to be executed. The case labels can have unique constants. For the switch statement to be meaningful, it must contain at least one case label.
You can specify only one default label. This label is not a required item. When you use this, do not specify any value.
switch (expression)
[case constant-value:]+
[expression;]*
...
...
[default:]
[expression;]*
endswitch;
When specifying the switch-endswitch statement, you have to follow the rules below:
case -5: // Valid
case +6: // Valid
case "String": // Valid
case intvar: // Invalid
case 3+2: // Invalid
switch (Stringvar1+Stringvar2) //Both variables are string type.
case 1: // Invalid
case "caption-1": // Valid
.
.
endswitch;
switch(i)
{
case 1:
case 2:
a=b+c; // If you do not specify this statement, the script
// analyzer will issue a syntax error.
}
s1="abcdefghijk";
switch (!AIT_IsEmpty(s1 ))
case true: // Executed if s1 is empty.
s2 = AIT_StrUpper(s1);
AIT_MessageBox("s2",s2);
if ( ( length = AIT_StrLength(s2)) > 10)
break;
endif;
break;
default: // Executed if the expression evaluates to false.
break; //
endswitch;