Debugging Your Application

Printing

There are three pretty-printing routines that will print out values to the Inspector window. While each one can print arrays and frames in a readable manner, they differ in small details, as shown in TABLE 8.1.

Differences among Print, Display, and Write.
 PrintDisplayWrite
Appends a new line after printing.X  
Surrounds strings with double quotes (e.g., "Hello").XX 
Prints dollar sign before characters (e.g., $H).XX 

Here are some examples that demonstrate these differences among Print, Display, and Write. The following code for Print:

Print("Hello"); Print($W); Print("orld");
produces

"Hello"
$W
"orld"
Using Display instead:

Display("Hello"); Display($W); Display("orld");
produces

"Hello"$W"orld"
Finally, using Write for the same text:

Write("Hello"); Write($W); Write("orld");
produces

HelloWorld
Controlling the Depth of Printing
Controlling the Number of Slots Printed

An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996