Phantom Documentation

[Help Home] [Phantom Home]


unload function;


function - The name of the function to remove

This keyword removes a user defined function. A user defined function can no longer be used after it has been removed using unload. If unload is used without a parameter, all functions in the "User Defined" package are removed. Functions declared after the package keyword must be unloaded individually. If the function specified by the parameter does not exist, nothing happens.

This can be useful when creating a function set file to be included in scripts. If the function set has already been loaded, errors will occur when the functions are re-declared. To avoid this, use the unload function to unload all the functions in the file before declaring them.

Example Code

# Declare some functions
function void f(int i){

function void f(int j, int k){
  disp(j + k);

function void g(int n){

# Show a list of user-defined
# functions
what("User Defined");

# Unload all f functions
unload f;
what("User Defined");

# Re-create the f function
# (no error will occur)
function void f(int m){
what("User Defined");

# Unload all functions
what("User Defined");

# Try to call an unloaded
# function. An error will
# occur.

See Also: Keywords

Copyright 2000-2011 Phantom Automated Solutions