Frames

Creating Frames

Creating a frame is so simple as to be disconcerting. Simply using { } creates a frame. Thus,

x := {};
creates a frame and assigns it to x. Here is another example, this time a frame assigned to a variable v:

v := {left: 10, right: 20, top: 10, bottom: 100};
The frame, v, has four slots, each containing an integer. You will find that frames are more readable when formatted vertically:

v := {
   left: 10, 
   right: 20, 
   top: 10, 
   bottom: 100,
};
Notice that the last slot has a trailing comma (,). When you format your frames with one slot per line, it is handy to end each line with a comma. Adding or deleting slots later is much easier when you do not have to treat the last line differently.


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

Last modified: 1 DEC 1996