assigned() function

The assigned() function determines if the variable has been assigned a value.

Syntax

assigned(var)

Parameter(s)

var Variable to check for assignment.

Description

If var has an assigned value, a nonzero value (true) is returned. If no value is assigned, 0 (false) is returned.

assigned() can tell if common variables have been previously assigned.

assigned() works well in BASIC subroutines called from the call AQL processing code. It prevents files from being repeatedly opened and variables from continually being re-initialized.

Tip: Rocket advises programmers to not rely on the assigned() function to return a specific nonzero value. Its exact value is undefined and can vary between implementations.

Example(s)

This determines if the file variable fv.entity has been assigned previously with the file statement. If it has not been assigned, the file statement is executed.

if not(assigned(fv.entity)) then file entity