Keyword Reference

首页  后退  前进

If...Then

单条件运行语句.

 

If <表达式> Then 语句

参数

表达式

条件表达式, 当表达式为 true 时, "语句"部分被执行.

备注

用于执行单条件语句,可以不需要 EndIf.

表达式可以包含布尔运算符: AND, OR, 或 NOT 以及逻辑运算符:

<, <=, >, >=, =, ==, 与 <>. 根据需要可以用圆括号组合使用.

相关

If...Else...EndIf, Select...Case...EndSelect, Switch...EndSwitch, Ternary

函数示例

#include <MsgBoxConstants.au3>
; Terminates script if no command-line arguments
If $CmdLine[0] = 0 Then Exit
; Alternative:
If $CmdLine[0] = 0 Then
    Exit
EndIf
MsgBox($MB_SYSTEMMODAL, "", "Script has command-line arguments.")

----------------------------------------