<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > Data types and variables > UNION |
Description
Define a User-Defined Data Type (UDT), containing one or more member elements.
UNION differs from TYPE because elements inside an UNION always share the same memory block.
Syntax
UNION MyUnion
[MemberName AS TypeName]
[MemberArrayName[(nElements)] AS TypeName]
[...]
END UNION
Returns
None
Parameters
Remarks
Restrictions
In case of string element, it is mandatory to specify a fixed size string.
UNIONs cannot have dynamic strings as element type.
See also
Examples
UNION tUnion
b(12) As Byte
st As ASCIIZ * 12
End UNION
Dim MyU As tUnion
MyU.b( 1) = 84
MyU.b( 2) = 104
MyU.b( 3) = 105
MyU.b( 4) = 110
MyU.b( 5) = 66
MyU.b( 6) = 97
MyU.b( 7) = 115
MyU.b( 8) = 105
MyU.b( 9) = 99
MyU.b(10) = 32
MyU.b(11) = 33
MSGBOX 0, MyU.st