Инструменты пользователя

Инструменты сайта


en:autorun:documentation:cond_switch

Switch..EndSwitch

Switch <expression>
  Case <value> [To <value>] [, <value> [To <value>]]
    ...
  [Case <value> [To <value>] [, <value> [To <value>]]
    ...]
  [Else
    ...]
EndSwitch

The <expression> value is sequentially compared to the values listed in the Case branches. If a match is found, the block of code after Case line is executed, other branches are not checked and ignored.

If the To keyword is used in the Case clause, the range of numbers in which the <expression> must be contained is specified. Note that the numbers you specify are included in a range: «1 to 10» will match numbers from 1 to 10, inclusive.

The result of the <expression> can be a string. In this case, the use of ranges is not possible, there can only be a list of values:

param = "/N"
Switch param
  Case "/N", "/M"
    ...
  Case "/C"
    ...
EndSwitch

String comparison is case-insensitive.

Notes

If none of the values match, the Else section (if any) will be executed.

Expressions can be nested.

Related

If..EndIf

en/autorun/documentation/cond_switch.txt · Последнее изменение: 2022/09/26 12:48 — loopback

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki