Declares an alias data type.
[scope] type type-name is data-type [, data-type]...
Variable | Description |
---|---|
scope | Optional: Either public (the default) or private. Private declarations are available only in the file in which they occur. Public declarations can be accessed from other files by means of a use statement. |
type-name | An identifier that names the type being declared. |
data-type | Any legal data type. If you specify only one data-type, variables of type-name can hold only data of that data type. If you specify multiple type names, objects with the new data type can hold data of any of the types you specify. This is called overloading and is described below. |
Declare aliases to create new data types that are specific to the needs of your scripts, or the application you are testing. An alias can simply be a new name for an existing type, or can be used to declare variables that can be assigned values of more than one type. This is called overloading.
type ManyItems is MyEnumType, MyRecordType
Overloading is useful when you want variables or function parameters to hold data of multiple types, like a string from a dialog box or its index value, which is an INTEGER. You could use type ANYTYPE for this purpose, but declaring an overloaded alias makes your code more robust.
[ ] type MyType is INTEGER, STRING [-] MyType ShiftyVar [ ] [-] switch (TypeOf (ShiftyVar)) [-] case INTEGER: [ ] // If the value TypeOf returns is INTEGER [ ] // do whatever... [-] case STRING: [ ] // if value is string... [ ] // do something else...
[ ] type int is INTEGER // For people accustomed to C [ ] type FILE is LIST OF STRING [ ] type MATRIX is ARRAY [4][4] OF NUMBER [ ] type MATRIX_LIST is LIST OF MATRIX [-] public type ITEM is INTEGER, STRING [ ] //holds integers or strings