Retrieving field values from an Icon record |
|
The notation ``r.f'' refers to field f of record r. For example, assuming you have declared the ``complex'' type (as in `Declaring an Icon record type'), you can write the imaginary part of a complex number x using:
write ( x.i );
Since a record in Icon is functionally identical to a list of the fields, you can also access the nth field of a record f as ``f[n]''.
For example, this expression writes all the fields of a record r:
every write ( ! r );
See
`Generating the elements of an Icon list'
for more information about the ``!'' operator.