Deftype statements (LotusScript® Language)

Set the default data type for variables, functions, and properties whose names begin with one of a specified group of letters.

Note: DefBool and DefByte are new with Domino® Release 6.

Syntax

DefBool range [, range] ...

DefByte range [, range] ...

DefCur range [ , range ] ...

DefDbl range [ , range ] ...

DefInt range [ , range ] ...

DefLng range [ , range ] ...

DefSng range [ , range ] ...

DefStr range [ , range ] ...

DefVar range [ , range ] ...

Elements

range

A single letter, or two letters separated by a hyphen. Spaces or tabs around the hyphen are ignored. A two-letter range specifies the group of letters including the given letters and any letters between. These must be letters with ASCII codes less than 128.

Letters in range are case insensitive. For example, the group of letters J, j, K, k, L, and l can be designated by any one of these range specifications: J-L, L-J, j-L, L-j, J-l, l-J, j-l, or l-j.

Usage

The following table lists the Deftype statements, the data type that each one refers to, and the data type suffix character for that data type.

Statement

Data type

Suffix character

DefBool

Boolean

(none)

DefByte

Byte

(none)

DefCur

Currency

@

DefDbl

Double

#

DefInt

Integer

%

DefLng

Long

&

DefSng

Single

!

DefStr

String

$

DefVar

Variant

(none)

Deftype statements can only appear at the module level, but they affect all declarations contained within the module at module level and within its procedures. They do not affect the declarations of data members of types and classes. They do affect declarations of function members and property members of classes.

All Deftype statements in a module must appear before any declaration, explicit or implicit, in the module. Exception: the declaration of a constant (by the Const statement) is not affected by Deftype statements.

No range in any Deftype statement can overlap any other range in the same Deftype statement or in any other Deftype statement in the same module.

The range A-Z is special. It includes all international characters, not only the letters with ASCII codes less than 128. It is the only range specification that includes international characters. For example, to change the default data type of all variables, functions, and properties to Single (the standard data type for several versions of BASIC), specify DefSng A-Z.

Declarations that are explicit as to data type (such as Dim X As Integer, Dim Y$, or Define MyFunction As Double) take precedence over Deftype declarations.

Example