DEFINED (anything)



SuperBASIC is different from other BASIC dialects in that it does not assign a default value to newly introduced but still unset variables (except on SMS which assigns the value Zero to an unset numeric variable and an empty string to an unset string).

This makes it possible for a program to detect if a variable has been properly initialised - an ‘error in expression’ (-17) is reported if you try to carry out operations on unset variables.

The function DEFINED takes any parameter, no matter what type it is, provided that it is a constant or a variable. DEFINED returns 0 if the parameter was a variable but unset and 1 for defined variables and constant expressions.


This function does not work on SMS


CLEAR makes all variables undefined. PRINT writes asterisks if unset variables are required to be printed. TYPE returns 1, 2 or 3 for undefined variables. See also UNSET.