]>
A Record is an object composed of one or more other objects, Record each of which is referenced selector:record with record:selector a selector. Components can all belong to the same type or each can have a different type.
Record components are implicitly ordered. All the components of a record can be set at once by assigning the record a bracketed tuple of values of the proper length. For example:
To access a component of a record , write the name , followed by a period, followed by a selector.
The object returned by this computation is a record with two components: a part and a part.
This is the quotient part.
This is the remainder part.
You can use selector expressions on the left-hand side of an assignment to change destructively the components of a record.
The selected component has the value , which is what is returned by the assignment. Check that the value of was modified.
Selectors are evaluated. Thus you can use variables that evaluate to selectors instead of the selectors themselves.
Be careful! A selector could have the same name as a variable in the workspace. If this occurs, precede the selector name by a single quote, as in selector:quoting u.'quotient.
Here we declare that the value of has two components: a string, to be accessed via name, and an integer, to be accessed via birthdayMonth.
You must initially set the value of the entire Record at once.
Once set, you can change any of the individual components.
Records may be nested and the selector names can be shared at different levels.
The record has a selector at two different levels. Here is an initial value for .
This extracts the component from the component of .
This extracts the component from .
You can also use spaces or parentheses to refer to Record components. This is the same as .
This is the same as .
This is the same as .
Look at to make sure it was modified.