Valid
(Engine-Level Function)
Description | Returns true if the parameter is any value other than Invalid. |
Returns | Boolean |
Usage | Script or steady state. |
Function Groups | Variable |
Related to: | Invalid |
Format: | Valid(X) |
Parameters: |
X |
Required. Any expression to be tested for validity. |
Comments | This function always returns a valid value. |
Examples:
a = Valid(1.23); b = Valid("Help"); c = Valid(Invalid); d = Valid(12.3 / 0);
The values for a, b, c and d will be 1, 1, 0 and 0 respectively.
A common use for this function is as an action trigger to prevent "if 1" conditions:
If !Valid(StartTime); [ StartTime = Seconds(); ]
This will cause the script to execute once and once only. startTime will be set to the time (in seconds since midnight) that the script was executed.