qb45advr.hlp (
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
DEFtype Statement Details
◄QuickSCREEN► ◄Details► ◄Example► ◄Contents► ◄Index►
──────────────────────────────────────────────────────────────────────────────
DEFtype Statement Details
Syntax
DEFINT letterrange [,letterrange]...
DEFSNG letterrange [,letterrange]...
DEFDBL letterrange [,letterrange]...
DEFLNG letterrange [,letterrange]...
DEFSTR letterrange [,letterrange]...
The letterrange has the form:
letter1[-letter2]
where letter1 and letter2 are any of the uppercase or lowercase
letters of the alphabet. Names beginning with the letters in
letterrange have the type specified by the last three letters of the
statement: integer (INT), long integer (LNG), single precision (SNG),
double precision (DBL), or string (STR). For example, in the following
program fragment, Message is a string variable:
DEFSTR A-Q
.
.
.
Message="Out of stack space."
The case of the letters in letterrange is not significant.
All of the following statements are equivalent:
DEFINT I-N
DEFINT i-n
DEFINT i-N
A type-declaration character (%, &, !, #, or $) always takes precedence
over a DEFtype statement. DEFtype statements do not affect record
elements.
Note: I!, I#, I&, I$, and I% are all distinct variables, and each
may hold a different value.
Differences from BASICA
BASICA handles DEFtype statements differently. BASICA scans a
statement each time before executing it. If the statement contains a
variable without an explicit type (indicated by !, #, &, $, or %),
the interpreter uses the current default type.
In the example below, when BASICA interprets line 20, it determines
that the current default type for variables beginning with I is
integer. Line 30 changes the default type to single precision.
When BASICA loops back to line 20, it rescans the line and uses
IFLAG as a single-precision variable.
10 DEFINT I
20 PRINT IFLAG
30 DEFSNG I
40 GOTO 20
In contrast, QuickBASIC scans the text only once; once a variable
appears in a program line, its type cannot be changed.