
180
|
Chapter 6, Speed Hacks
#46 Master the Command Window
HACK
and set the values of variables. You can simply type a question mark, a space,
and then the name of a variable, and when you press Enter, the value of that
variable will be printed to the screen. Here is an example of this command:
>? i
0
In this example, the value of the variable i is zero. You can also set the value
of a variable through the command window by using the question mark, a
space, the name of the variable, and then an equals sign and the value that
you want to set the variable to. Here is an example of setting the value of a
variable through the command window:
>? i =2
2
As an alternative to using the question mark, you can also set the command
window to immediate mode; this turns the command window into an imme-
diate window and you no longer need to use a question mark. You can set
the command window to immediate mode by typing in the command
immed.
Following is a transcript of using the command window in immediate mode:
>immed
i
0
To switch the command window back into command mode, you simply need
to type in any command prefixed with
>. For instance, you could type >cmd
and the window would switch back to command mode.
Another benefit to viewing the value of a variable in the command window
is that it is easy to copy the value of that variable out of the command win-
dow. If you are working with a large string of XML, it might ...