LOTUSSCRIPT LANGUAGE


Type statement
Example

Defines a user-defined data type consisting of one or more members.

Syntax

[ Public | Private ] Type typeName

member declarations

End Type

Elements

Public | Private


typeName
member declarations
Usage

Defining types
A Type statement is valid only at module level.

The word Object is illegal as a type name.

Declaring type members
A member is a variable declaration without the Dim, Private, Public, or Static keywords. A member cannot be declared to be Private, Public, or Static; it's automatically Public.

Each member statement declares one variable.

The data type of a member can be any of the scalar data types, a Variant, a fixed array, or any other user-defined data type. It cannot be the same data type as that being defined by the current Type statement.

A member declared as Variant can hold any scalar value, an array (fixed or dynamic), a list, or a reference to a user-defined object, a product object, or an OLE Automation object. The following rules apply to type instances that have Variant members containing arrays, lists, or objects:


A member can use any LotusScript keyword, except Rem, as its name.

Declaring a type variable
A user-defined data type name is used in variable declarations in the same way as any other data type. The common variable declaration has the syntax:

Dim varName As typeName

This declaration declares a variable of the type typeName and initializes the members of the new variable. The initial values of the members are the same as for ordinary variables:


If a member is itself a user-defined data type, then it is assigned initial values in the same manner.

Referring to type members
Refer to members of a type using dot notation, in the form varName.memberName. Spaces, tabs, and newline characters are legal on both sides of the period (after varName and before memberName).

Member references can also include array subscripts if the member is an array.

Example
See Also