
156
LESSON 12 Debugging CoDe
FIGURE 125
USING THE IMMEDIATE WINDOW
While the program is stopped, the Immediate window lets you execute simple commands. The four
most useful commands that this window supports let you view variable values, evaluate expressions,
set variable values, and call methods.
If you can’t find the Immediate window, open the Debug menu, expand the
Windows submenu, and select Immediate.
To view a variable’s value, simply type the variable’s name and press [Enter]. (Optionally you can
type a question mark in front if it makes you feel more like you’re asking a question.)
The following text shows the Immediate window after I typed in the name of the variable
subtotal (actually I typed “sub” and pressed [Ctrl]+[Space] to let IntelliSense help me type
the rest) and pressed [Enter]:
subtotal
19.95
To evaluate an expression, simply type in the expression and press [Enter]. You can include literal
values, variables, properties, constants, and just about anything else that you can normally include
inside an expression in the code.
The following text shows the Immediate window after I typed an expression and pressed [Enter]:
taxRate * subtotal
179.55
596906c12.indd 156 4/7/10 12:32:42 PM