Structures are just arrays whose elements are named.
Normally, structures are only used when a function returns a structure.
To access members, use the '.' operator:
print( a.height ); print( a.width ); |
The syntax to create a structure is kind of weak, because it looks just like you're declaring an array:
Local a Array; |
To add members, use the '.+' operator:
Local a Array; a.+height; a.+width; a.height := 5; |
A more complete example:
function get_position()
begin
Local posn Array;
posn.+x := GetX();
posn.+y := GetY();
return posn;
end
|