Xbasic
TYPE ... END TYPE
IN THIS PAGE
Syntax
TYPE Xbasic_Structure_Name
SubVariable1 as Type1
SubVariable2 as Type2
SubVariableN as TypeN
END TYPE
Arguments
- Xbasic_Structure_Name
The generic name of the variable type that you are creating.
- SubVariable1 ... SubVariableN
The names of the components of the structure.
- Type1 ... TypeN
The variable type of each component:
- N
numeric
- D
date
- C
character
- L
logical
- P
pointer
- T
time
- B
blob
- U
collection
- A
any type
- Integer
32 bit integer, equivalent to C long int
- Short
16 bit integer, equivalent to C short int
- Byte
8 bit integer, equivalent to C unsigned char
- {YourType}
a user defined type created with a different TYPE ... END TYPE command.
Description
Defines an Xbasic structure.
Discussion
TYPE ... END TYPE defines an Xbasic structure, which allows you to quickly define dot variables with sub-variable names defined by the Xbasic_Structure_Name.
In many cases, using an Xbasic class will be preferable to using the TYPE command. See example below. See also DIM.
Examples
' Declaring Variables Using a Structure ' Define the structure. type customer name as C company as C phone as C age as N end type dim cust as {customer} ? properties_enum(cust) = NAME COMPANY PHONE AGE dim custs[10] as {customer} ? properties_enum(custs[1] ) = NAME COMPANY PHONE AGE ' The Windows POINT structure would be represented by : type point x as integer y as integer end type ' a new type contain point types type line x as {point} y as {point} end type
Example: Using an Xbasic Class
define class myclass dim name as c dim time_start as t dim duration as y end class dim b as myclass ?b = name = "" duration = 12:00:00 00 am time_start = 00/00/0000 12:00:00 00 am
See Also