Variables
 

Syntax


symbolname = expression      ' automatic declaration  for INTEGER

   or

DIM symbolname  AS INTEGER

DIM floatingpoint AS SINGLE

Description


    Variables are values which can be manipulated. They are referenced using names composed of letters, numbers, and character "_". These reference names cannot contain most other symbols because such symbols are part of the ARMbasic programming language. They also cannot contain spaces.  
   
    32-bit signed whole-number data type. Can hold values from -2147483648 to 2147483647. 

    Single variables can hold positive and negative numbers 0.0, 1.0000E-39 to 1.0000E+38.  Within this range there are 7 significant digits.  Outside this range numbers will print as NaN -- not a number or Inf for infinity .

    Variables are declared automatically on first use.  A DIM statement is not required, but can be used.  Once a INTEWGER variable is declared using a DIM, then all following variables must be declared that way .

    Variable names must start with a letter or _ character, but then can contain letters, numbers or the _ character. The name must also contain at least one letter.  Only the first 32 characters of a variable name are used, beyond that they are truncated.  Also names are not case sensitive.

Example

FirstNumber = 1
SecondNumber = -2
ThirdNumber = &H20

PRINT
FirstNumber, SecondNumber, ThirdNumber 'This will print 1      -2      32

DIM FirstNumber AS INTEGER
DIM SecondNumber AS INTEGER
DIM ThirdNumber AS INTEGER

FirstNumber = 1
SecondNumber = -2
ThirdNumber = &H20

PRINT
FirstNumber, SecondNumber, ThirdNumber 'This will print 1      -2      32
Differences from other BASICs
 
 

 
See also

 

DIM