Creating an Icon record object |
|
Once you have defined the fields that go into a given record type (see `Declaring an Icon record type'), you can create one record of that type by using the record's name followed by parentheses.
For example, suppose your program contains this declaration:
record complex ( r, i )
This expression would create a record of type ``complex''
and store it in variable ``x'':
x := complex ( );
If you wish, you can supply initial values for the fields by
placing them inside the parentheses. For example, this expression
y := complex ( 0, 5.9 );
would set ``y'' to a record of type ``complex''
whose ``r'' field would contain the integer 0 and whose
``i'' field would contain the real number 5.9.