Select...Case...EndSelect
条件运行语句.
Select
Case <表达式 1>
语句
...
[Case <表达式 2>
语句 2
...]
[Case <表达式 n>
语句 n
...]
[Case Else
Else 语句
...]
EndSelect
参数
<表达式>
|
如果表达式为 true, 则执行从下一行开始, 直到下一个 Case 或 EndSelect 为止的所有语句.
如果有多个 Case 表达式成立, 则只执行第一个 Case 语句.
|
备注
Select 语句允许嵌套使用.
表达式可以包含布尔运算符: AND, OR, 或 NOT 以及逻辑运算符:
<, <=, >, >=, =, ==, 与 <>. 根据需要可以用圆括号组合使用.
相关
If...Then, If...Else...EndIf, Switch...EndSwitch, ContinueCase
函数示例
#include <MsgBoxConstants.au3>
Example()
Func Example()
Local $iValue = 0
Local $sBlank = "Test"
Select
Case $iValue = 1
MsgBox($MB_SYSTEMMODAL, "", "The first expression was True.")
Case $sBlank = "Test"
MsgBox($MB_SYSTEMMODAL, "", "The second expression was True")
Case Else ; If nothing matches then execute the following.
MsgBox($MB_SYSTEMMODAL, "", "No preceding case was True.")
EndSelect
EndFunc ;==>Example
----------------------------------------
|