
The Inspector
Example
Now, we will look at an example of evaluating code in the Inspector window. In order to calculate the sum of 1, 2, 3, 4, and 5, type:
1 + 2 + 3 + 4 + 5
into the Inspector. You can evaluate the code in one of two ways:
- Select the entire line and press the "Enter" key (see FIGURE 8.1).
- Press the "Enter" key without selecting the line (see FIGURE 8.2).
In both cases, the code is compiled and downloaded to the Newton, where it is interpreted, and then the result, 15, is printed in the Inspector (see FIGURE 8.3).

FIGURE 8.1 : Executing the selected NewtonScript.

FIGURE 8.2 : Executing the NewtonScript on the line with the insertion point.
As FIGURE 8.3 shows, the Inspector prints a hexadecimal number before printing the actual value, 15. This hexadecimal number is the 32-bit value representing the number 15 and is not something that should cause you further concern.

FIGURE 8.3 : Results of executing NewtonScript code.
Note:
You may want to stop the Inspector from printing out the value of the code it is executing (for instance, you may be assigning a large frame or array to a variable). To suppress the execution echo, add a nil
statement at the end of your code line or block. Since the value of a sequence of statements is the value of the last statement, only nil
will be echoed.
For example, instead of executing
x := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
execute:
x := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; nil;
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996