The ASSIGNED() function tests whether a variable is assigned.
All QMBasic variables except those in common blocks are initially unassigned. Any attempt to use the contents of the variable in an expression would cause a run time error until such time as a value has been stored in it. The ASSIGNED() function allows a program to test whether a variable has been assigned, returning True if it is assigned or False if it is unassigned.
SUBROUTINE VALIDATE(ACCOUNT.CODE, ERROR)
IF ASSIGNED(ACCOUNT.CODE) THEN
ERROR = 0
ERROR = 1
This program fragment validates an account code. The use of the ASSIGNED() function prevents an abort if the variable has not been assigned.