Understanding type definition

This is an introduction to types.

The TYPE instruction declares a user-defined type, which can be based on:

Once declared, a type can be referenced in the declaration of program variables, or in other types.

Types are typically defined to avoid the repetition of complex structured types.

Tip:

User-defined types improve code readability by centralizing data structure definitions. Consider using PUBLIC TYPE definitions to share types across modules with IMPORT FGL.

Types can also be completed with methods to encapsulate the data, and use the concept of polymorphism with interfaces.

Anonymous types are defined automatically when defining variables and no explicit TYPE definition is used. For more details, see Anonymous types.