Phantom Documentation

[Help Home] [Phantom Home]
clear

Syntax:

clear variable;
clear;

Where,

variable - The name of the variable to remove.

Description:
The clear keyword removes one or more variables from memory. The variable will no longer be available, and if it is used, an error will occur. A new variable with the name of a cleared variable can be created. If no 'variable' parameter is used, all variables are removed.

Example Code

# Add a variable
int x = 10;
who();

# Remove the variable using clear
clear x;
who();

# Add another variable with the
# same name (no error produced)
real x = 32.2;
string s = "hello";
who();

# Clear all variables
clear;
who();

# Try to use a cleared variable.
# This will produce an error.
x = 12.2;



See Also: Keywords



Copyright 2000-2011 Phantom Automated Solutions