Because data types are determined "on the fly" in Raptor, the programmer cannot always be sure what type a variable has during program execution. In some cases, the programmer may want the program to determine the type of a variable before continuing.
The four functions below can be used to determine the type of a variable during run time.
Each function
takes a variable name as an argument (not an arbitrary expression)
returns a boolean value (so will normally appear in a diamond for a selection or loop structure)
Is_Array(variable)
Is_Array is a function that returns true if variable is a one-dimensional array, false otherwise.
Is_Number(variable)
Is_Character is a function that returns true if variable is a scalar (single) character, false otherwise.
Is_Number(variable)
Is_Number is a function that returns true if variable is a scalar (single) numeric variable, false otherwise.
Is_String(variable)
Is_String is a function that returns true if variable is a string variable, false otherwise.
Is_2D_Array(variable)
Is_2D_Array is a function that returns true if variable is a two-dimensional array, false otherwise.