Home

Back

Contents

Next

Special Variables and Values

In addition to the scope modifiers: 'this', 'super', 'global', BeanShell supports a number of pre-defined system variables and some "magic" values.

Special Values

Note:
The choice of "bsh" for the root system object name was somewhat unfortunate because it conflicts with the current package name for BeanShell (also bsh). This means that if you wish to work with BeanShell classes explicitly from BeanShell scripts (e.g. bsh.Interpreter) you must first import them, e.g.:
    import bsh.Interpreter;
    i=new Interpreter();

Special Members of 'this' type References

'this' type references have several "magic" members:

These magic references are primarily used by BeanShell commands.

Undefined Variables

You can test to see if a variable is defined using the special value void. For example:

if ( foobar == void )
    // undefined

You can return a variable to the undefined state using the unset() command:

a == void;  // true
a=5;
unset("a"); // note the quotes
a == void;  // true


Home

Back

Contents

Next