DEFINED real-valued function DEFINED real-valued function Syntax DEFINED (var_name) Function Determine whether a variable has been defined. Parameter var_name The name of a location, string, or real variable. Both scalar variables and array variables are permitted. A location variable can be a transformation, a precision point, or a belt variable. Details The value of the specified variable is tested. If the value is defined, the function returns the value TRUE. Otherwise, the value FALSE is returned. For array variables, if a specific array element is specified, the single array element is tested.
If no array element is specified, this function returns a TRUE value if any element of the array is defined. NOTE: For nonreal arguments (i.e., strings, locations, transformations) that are passed in the argument list of a CALL statement, you can test to see if the variable is defined or not. However, you cannot assign a value to undefined nonreal arguments within the CALLed program. If you attempt to assign a value to an undefined nonreal argument, you receive an undefined value error message. Therefore, when using DEFINED to test for user input, be sure to assign a default value to the variable before testing it. See the example below.
Examples .PROGRAM test($s) AUTO $tmp $tmp = "default" IF DEFINED($s) THEN $tmp = $s END TYPE /C3 "The string is: ", $tmp When the example above is executed with a value: ex test("ABCD") eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 159