Built-in functions
For a complete list of built-in functions, please visit here. For the precautions for using built-in functions, please visit here.
Custom functions
Users can customize functions by using the Func...EndFunc statement.
The parameters of the function and their return value can be defined as needed.
The function name must start with a letter or underscore "_", and the remaining parts (non-first characters) can be selected at will from letters, numbers or underscores. The following are all legal function names:
MyFunc
Func1
_My_Func1
Here is an example function, which is the function of obtaining 10 times the number:
$val = 10
For $i = 1 To 10
$doubled = MyDouble($val)
MsgBox(0, "", $val &" twice is "& $doubled)
$val = $doubled
Next
Exit
Func MyDouble($value)
$value = $value * 2
Return $value
EndFunc
For a complete list of built-in functions, please visit here. For the precautions for using built-in functions, please visit here.
Custom functions
Users can customize functions by using the Func...EndFunc statement.
The parameters of the function and their return value can be defined as needed.
The function name must start with a letter or underscore "_", and the remaining parts (non-first characters) can be selected at will from letters, numbers or underscores. The following are all legal function names:
MyFunc
Func1
_My_Func1
Here is an example function, which is the function of obtaining 10 times the number:
Copy the codeThe code is as follows:
$val = 10
For $i = 1 To 10
$doubled = MyDouble($val)
MsgBox(0, "", $val &" twice is "& $doubled)
$val = $doubled
Next
Exit
Func MyDouble($value)
$value = $value * 2
Return $value
EndFunc