qb45advr.hlp (Topic list)
Variables
  Data Types   Variables   Contents   Index
──────────────────────────────────────────────────────────────────────────────
Variables
A variable is a name that refers to an object--a particular number, string,
or record. (A record is a variable declared to be a user-defined type.)
 
  ■ Simple variables refer to a single number, string, or record.
  ■ Array variables refer to a group of objects, all of the same type.
 
A numeric variable, whether simple or array, can be assigned only a numeric
value (either integer, long integer, single precision, or double
precision).
 
A string variable can be assigned only a character-string value.
 
You can assign one record variable to another only if both variables are the
same user-defined type. However, you can always assign individual elements
of a record to a variable of the corresponding type.
 
The following list shows some examples of variable assignments:
 
  ■ A constant value:
      A = 4.5
 
  ■ The value of another string or numeric variable:
      B$ = "ship of fools"
      A$ = B$
      Profits = NetEarnings
 
  ■ The value of a record element:
      TYPE EmployeeRec
        FullName AS STRING * 25
        SocSec   AS STRING * 9
      END TYPE
      DIM CurrentEmp AS EmployeeRec
      .
      .
      .
      OutSocSec$=CurrentEmp.SocSec
 
  ■ The value of one record variable to another record variable of the
    same type:
      TYPE FileBuffer
        FullName AS STRING * 25
        JobClass AS INTEGER
      END TYPE
      DIM Buffer1 AS FileBuffer
      DIM Buffer2 AS FileBuffer
      .
      .
      .
      Buffer2 = Buffer1
 
  ■ The value obtained by combining other variables, constants, and
    operators:
      CONST PI = 3.141593
      Conversion = 180 / PI
      TempFile$ = FileSpec$+".BAK"
 
In any case, the variable must always match the type of data (numeric or
string) assigned to it.
 
  Note: Before a variable is assigned a value, its value is assumed to be
        zero (for numeric variables) or null (for string variables). All
        fields in a record, including string fields, are initialized to
        zero.
 
See Also  Variable Names
          Declaring Simple Variables
          Declaring Array Variables
          Variable Storage Allocation