Syntax:
unload function;
unload;
Where,
function - The name of the function to remove
Description:
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){
disp(i);
}
function void f(int j, int k){
disp(j + k);
}
function void g(int n){
disp(n*2);
}
# 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){
disp(m/2);
}
what("User Defined");
# Unload all functions
unload;
what("User Defined");
# Try to call an unloaded
# function. An error will
# occur.
f(6); |
See Also:
Keywords