Syntax |
DefInt letterrange |
|
Description |
Establishes the default type assigned to undeclared or untyped variables. |
|
Comments
|
The DefType statement controls automatic type declaration of variables. Normally, if a variable is encountered that hasn't yet been declared with the Dim, Public, or Private statement or does not appear with an explicit type-declaration character, then that variable is declared implicitly as a variant (DefVar A–Z). This can be changed using the DefType statement to specify starting letter ranges for type other than integer. The letterrange parameter is used to specify starting letters. Thus, any variable that begins with a specified character will be declared using the specified Type. |
|
|
The syntax for letterrange is: letter [-letter] [,letter [-letter]]... DefType variable types are superseded by an explicit type declaration¾using either a type-declaration character or the Dim, Public, or Private statement. |
|
|
The DefType statement only affects how the Basic Control Engine compiles scripts and has no effect at runtime. The DefType statement can only appear outside all Sub and Function declarations. The following table describes the data types referenced by the different variations of the DefType statement: |
|
|
Statement |
Data Type |
|
DefInt |
Integer |
|
DefLng |
Long |
|
DefStr |
String |
|
DefSng |
Single |
|
DefDbl |
Double |
|
DefCur |
Currency |
|
DefObj |
Object |
|
DefVar |
Variant |
|
DefBool |
Boolean |
|
DefDate |
Date |
Example |
DefStr a-m DefLng n-r |
|
|
Const crlf = Chr$(13) + Chr$(10) Sub Main() a = 100.52 |
|
See Also |
Currency (data type); Date (data type); Double (data type); Long (data type); Object (data type); Single (data type); String (data type); Variant (data type); Boolean (data type); Integer (data type). |
D |