|
Type Statement |
Top Previous Next |
Function: |
Used to declare structures -- combinatorial data types that includes one or several member variables. |
Syntax: |
type type_name name1 [ (bounds1) ] as type [ (max_string_size) ] ... nameN [ (boundsN) ] as type [ (max_string_size) ] end type |
Scope: |
Global, HTML and local |
See Also: |
Part |
Description |
type_name |
Required. Specifies the name for this structure type (not a particular variable). |
name[1, 2...] |
Required. Specifies the name for the member variable. |
bounds[1, 2...] |
Optional. Specifies the boundary (finite size) of a dimension in an array. Several comma-delimited boundary values make a multi-dimensional array. |
as |
Required. Precedes the type definition. |
type |
Required. Specifies the type of the variable. |
max_string_size |
Optional (can be used only when type is string). Sets the maximum size for a string (default size is 255 bytes). |
end type |
Required. Closes type declaration. |
Details
Structures can include any number of members, and each member can be of any type. Any member can also be an array or another structure. Nesting of up to 8 levels is allowed (i.e. "array within a structure within a structure within and array" -- each structure or array is one level and up to 8 levels are possible).
Type...end type is only a declaration, not a variable definition! You still need to use a regular dim statement to define a variable of the type you have declared.
Examples
'declare new type type my_struct x as byte y as Long s as string(10) end type
'define a variable of this type dim my as my_struct
|