|
Navigation: thinBasic language > Data types and variables > TYPE |
![]() ![]()
|
Description
Define a User-Defined Data Type (UDT), containing one or more member elements.
Syntax
TYPE MyType
[MemberName AS TypeName]
[MemberArrayName[(nElements)] AS TypeName]
[...]
END TYPE
Returns
None
Parameters
Remarks
thinBasic support any level of nesting types. Any element of a type can be:
| • | numeric (any supported type) |
| • | string (fixed strings) |
| • | variants |
| • | another type (allowing nesting types inside another one) |
Restrictions
In case of string element, it is mandatory to specify a fixed size string.
See also
Examples
'---
TYPE MyRect
x AS LONG
y AS LONG
w AS LONG
h AS LONG
END TYPE
'---
TYPE MyData
Val1 AS INTEGER
Val2 AS LONG
Val3 AS STRING * 255
Val4 AS EXT
Re AS MyRect '---Note, a type inside a type
Val5 AS QUAD
Val7 AS DOUBLE
END TYPE
DIM Info AS MyData
Info.Val1 = 10
Info.Re.x = 20
MSGBOX 0, Info.Val1 & "-" & Info.Re.x
| © 2004-2008 thinBasic. All rights reserved. | Version 1.6.0.9 | Web Site: http://www.thinbasic.com |