qck.hlp (Table of Contents; Topic list)
Assigning Values to Variables
                                                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 Assigning Values to Variables
 
 ■ A variable is a name that refers to an object - a particular number,
   string, record (user-defined type), form, control, or special object
   (CLIPBOARD, PRINTER, or SCREEN). For example:
 
   Variable Type     Description
   ═════════════     ═══════════════════════════════════════════════════════
   Simple            Refers to a single number, string, record, form, or
                     control or special object (CLIPBOARD, PRINTER, SCREEN)
   Array             Refers to a group of objects, all of the same type -
                     for example, an option button group
   Numeric           Simple or array; can only be assigned a numeric value
                     (INTEGER, LONG, SINGLE, DOUBLE, or CURRENCY)
   String            Can be assigned only a character-string value
   Record            Can be assigned to one another only if both variables
                     are the same user-defined type; you can always assign
                     individual elements of a record to a variable of the
                     corresponding type
 
 ■ 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.
 
 ■ A variable must always match the type of data (numeric or string)
   assigned to it. For example:
 
   If the value assigned is...         Then the code looks like this...
   ════════════════════════════════    ═════════════════════════════════════
   A constant value                    A = 4.5
 
   Another string or numeric           B$ = "ship of fools"
   variable                            A$ = B$
                                       Profits = NetEarnings
 
   A record element                    TYPE EmployeeRec
                                            FullName AS STRING * 25
                                            HireDate AS STRING * 9
                                       END TYPE
                                       DIM CurrentEmp AS EmployeeRec
                                       .
                                       .
                                       .
                                       OutHireDate$=CurrentEmp.HireDate
 
   An array element in a record        TYPE EmployeeRec
                                            FullName    AS STRING * 25
                                            HireDate    AS STRING * 9
                                            ChildAge(6) AS INTEGER
                                       END TYPE
                                       DIM CurrentEmp AS EmployeeRec
                                       .
                                       .
                                       .
                                       FirstChildAge = CurrentEmp.ChildAge(1)
 
   One record variable to another      TYPE FileBuffer
   of the same type                         FullName AS STRING * 25
                                            JobClass AS INTEGER
                                       END TYPE
                                       DIM Buffer1 AS FileBuffer
                                       DIM Buffer2 AS FileBuffer
                                       .
                                       .
                                       .
                                       Buffer2 = Buffer1
 
   The value obtained by combining     CONST PI = 3.141593
   other variables, constants, and     Conversion = 180 / PI
   operators                           TempFile$ = FileSpec$+".BAK"
   ─────────────────────────────────────────────────────────────────────────
 
 See: Variables Summary