Section 5. Program Declarations
5-2
Const Declaration Example
The example uses Const to define the symbolic constant PI.
Const
PI = 3.141592654
'Define constant.
Dim Area, Circum, Radius
'Declare variables.
Radius = Volt( 1 )
'Get measurement.
Circum = 2 * PI * Radius
'Calculate circumference.
Area = PI * ( Radius ^ 2 )
'Calculate area.
DIM
Declares variables and allocates storage space. In CRBasic,
ALL
variables
MUST
be declared.
Syntax
Dim
varname
[([
subscripts
]) [,
varname
[([
subscripts
])]]
Remarks
The
Dim
statement has these parts:
Part Description
varname
Name of a variable.
subscripts
Dimensions of an array variable. You can declare multiple
dimensions.
The argument subscripts has the following syntax:
size [size, size]
In CRBasic the Option Base is always 1. This means the lowest number in a
dimension is 1 and not 0.
Dim
A( 8, 3 )
The maximum number of array dimensions allowed in a
Dim
statement is 3. If a
program uses a subscript that is greater than the dimentioned value, a subscript out
of bounds error is recorded.
When variables are initialized, they are initialized to 0
Tip
Put
Dim
statements at the beginning of the program.
PUBLIC
Dimensions a variable as public and available in the Public table of the CR9000.
Syntax
Public
(
list of [dimensioned] variables that make up the Public Table
)
Remarks
More than one Public statement can be made.
Summary of Contents for CR9000
Page 6: ...CR9000 Table of Contents iv This is a blank page ...
Page 22: ...CR9000 Overview OV 16 This is a blank page ...
Page 26: ...Section 1 Installation 1 4 CR9000 FIGURE 1 1 3 CR9000 Battery Pack ...
Page 72: ...Section 3 CR9000 Measurement Details 3 28 This is a blank page ...
Page 88: ...Section 5 Program Declarations 5 6 This is a blank page ...
Page 217: ...This is a blank page ...