Console variables

The console allows us to set and echo variables. Variable names are prefixed with a $ sign.


set greeting=Hello                   # Sets a variable
echo $greeting world                 # Displays output
set v2=$greeting                     # One variable set to the value of another
number=three                         # "set" can be omitted

In all the examples above the variables hold strings. But variables can hold other types, too, and we force this using braces:


intnum={int:3}                       # Braces force a type. Here, an int
longnum={long:3}                     # This sets a long
convnum=3                            # An integer string is converted to an int
somestring={string:3}                # This forces the variable to be a string
id={x500dn:o=jtrix,ou=development}   # Set an X.500 distinguished name
w1={warrant:myfile.xml}              # Read a warrant into a variable from a file
w2={warrant:http://www.mysite.com/warrants?id=37}    # ...or from a URL

When we use braces to convert our entered string to a named type, that type must be supported by the Property class.

Notice that because a warrant is XML, a warrant variable is converted from the contents of a named file or URL--warrants are far too long to enter by hand.

Nik Silver 2002-03-09