Structures
Structures allow a single value to contain multiple named FISH variables. This is a programming data structure that can be used to compartmentalize FISH variables.
See the Structure Utilities for available methods.
A structure may be defined either with the fish structure
command, or with the struct or structure statement as the first thing on a line of FISH input.
An instance of a structure may be created anywhere in an expression by using the struct or structure keyword, followed by the name of the structure and optionally values to initialize structure members as arguments. If uninitialized, structure members have the default FISH value of 0.
Structure members can contain any valid FISH values, including lists or other structures.
Structure members can be accessed using the accessor -> operator followed by the member name. Structure member access is much more efficient than in previous versions of FISH, only slightly slower than direct variable access.
Structure types can be compared against each other with ==, <, > etc. If the structures are of the same type name then each member is compared in order.
The example below illustrates the use of structures.
As with most aggregate types, when the value is listed it will simply indicate that it is of type Structure and the structure name. To see the contents of the structure use the fish list contents
command.
Was this helpful? ... | Itasca Software © 2024, Itasca | Updated: Oct 31, 2024 |