IsSet

Returns a non-zero number if the specified variable has been assigned a value.

IsSet := IsSet(Var)

Parameters

Var

Type: Variable

A reference to the variable. For example: IsSet(MyVar).

Return Value

Type: Integer (boolean)

This function returns 1 (true) if Var has been assigned a value, otherwise 0 (false).

Remarks

A variable which has not been assigned a value is also known as an uninitialised variable. Attempting to access an uninitialised variable (by almost any means other than this function) causes a warning to be displayed by default, but a future release will replace this warning with an error.

IsSet can be used to determine whether a variable requires initialization, such as for initializing a global or static variable on first use.

Note: Static initializers such as static my_static_array := [] are evaluated only once, the first time they are reached during execution, so typically do not require the use of IsSet.

Known limitation: If the MsgBox warning mode is in effect, triggering the warning message for a given variable has the side-effect of initializing that variable to prevent further warnings. This causes IsSet to return true for subsequent calls.

Related

ByRef parameters

Examples

#1

MsgBox Function(MyVar)

Function(ByRef Param)
{
    return IsSet(Param)
}