Fundamentals of NewtonScript

Arrays


[element1, element2, element3, element4, ...]


An array in NewtonScript is an ordered collection of values. NewtonScript arrays are similar to C or Pascal arrays, but much more powerful. Their dynamic nature--arrays can grow or shrink--and their versatility--elements in an array need not be of the same type--makes them much more functional than their traditional counterparts. Here are three examples of arrays:

mixer:= ["Hello", 5, 4.32, "World!", nil];
desserts:= ["cake", "pie", "flan", "ice cream",];
x : = [15, "xyz", {a: 2, b: 3}];
You can add, delete, modify, or retrieve elements from arrays. In NewtonScript, you'll use arrays rather than frames if the order of elements is important.

Creating Arrays
Adding Elements
Removing Elements
Using Arrays as Sets

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

Last modified: 1 DEC 1996