release all

Prev Next

Function Names

release all

Description

This function releases all reference variable either in the specified variable or in one of its members or sub-members. If no parameter is specified, then all locally defined references to variables (for example in a user-defined functions) will be released. All released references to variables turn into regular variables containing void values. See release() for further details.

In contrast to release(), no exception is asserted if the specified variable is neiter a reference to a variable nor containing references. This setup allows to release all references in variables which contain a mix of direct contents and references and carries out an effective clean-up. Protected variables as well as function parameters containing references will not be released.

References defined in local variables will be released automatically when execution of user-defined functions or B4P programs called with start() or include() have been completed.

Call as: procedure

Restrictions

Indirect parameter passing is disabled

Parameter count

Min. 0

Parameters

No.TypeDescription
1, etc.
code
variable
:string
Variable name

The specified variable(s) may (but must not necessarily) contain variable references. No actions if the variable contains no references at all.

Examples

       Country[] = USA;
       Country[State] = Pennsylvania;
       Country[State,Town] = Wilkes Barre;

       a[wb] = ^Country[State,Town];
       a[pa] = ^Country[State];
       a[us] = The United States;

       b[] = '';
       echo(a[wb],", ", a[pa],", ", a[us]);

       release all( a[] ); // Also try: release all;
       echo(a[wb],", ", a[pa],", ", a[us]);

Output

Wilkes Barre, Pennsylvania, The United States
# Invalid Value #, # Invalid Value #, The United States
Try it yourself: Open LIB_Function_release_all.b4p in B4P_Examples.zip. Decompress before use.

See also

release