Default
函数调用时,参数使用默认" Default "关键字.
$var = Default
备注
这个关键字不能用于计算类型的表达式. AutoIt 无法检测这种情况, 将引起性能恶化.
当做参数传递使用时, 其行为在对应的 AutoIt 函数文档中指定.
编辑 UDF 函数时, 应检查参数是否被设置为 Default 关键字, 及是否执行相应动作.
如果使用此关键字, 传递的参数值将被设置为默认值, 而不是可选其它值得参数.
相关
IsKeyword, Null
函数示例
#include <MsgBoxConstants.au3>
Example(Default, Default)
Func Example($vParam1 = Default, $vParam2 = "Two", $vParam3 = Default)
If $vParam1 = Default Then $vParam1 = "One" ; If the Default keyword is used, the assign the variable as "One"
If $vParam3 = Default Then $vParam3 = "Three" ; If the Default keyword is used, the assign the variable as "Three"
; Display the following parameters passed to the function.
MsgBox($MB_SYSTEMMODAL, "Paramaters", "1 = " & $vParam1 & @CRLF & _
"2 = " & $vParam2 & @CRLF & _
"3 = " & $vParam3)
EndFunc ;==>Example
----------------------------------------
|