How to Declare a Structure

You start a structure declaration with Struct, and you complete it with End or End Struct. You must write each of these on different lines. Between these lines you must declare one or more elements. All data types are permitted, but not all can have @Shared for a modifier.

You can initialize elements in the structure declaration the same as you do with Dim.

When you declare a variable with a structure type, you get access to the elements through the variable.

To compare structures with classes, see Structures and Classes.

Steps

  1. Write the start and end lines for the structure.

    Struct Employee
    End Struct
    
  2. Add elements to the body of the structure.

    A structure must have a minimum of one element.

    Struct Employee
        name As String
        startDate As DateTime
        salary As Fixed64
    End Struct