Struct name
   field [initializer], field [initializer], ...
 EndStruct

Define a structure. A structure is a blueprint for a series of objects with an identical set of properties.

Lines after the Struct keyword define the properties (fields) that are part of the structure. Each line defines one or more fields, separated by commas.

A structure is instantiated with Dim:

 Struct Pair
   First, Second
 EndStruct
 Dim p As Pair
 p->First := 1          % Set a field
 With p Do Second := 2  % Alternative version

Each field can have an optional initializer. See Dim for allowed forms of initializers. The initializer defines the initial value of the structure field. If no initializer is given, the field starts out EMPTY.

Internally, a structure is implemented as a constructor function. Instead of using Dim...As, you could also call the constructor function directly: p := Pair().

See also: Dim, Elementary Commands