Campbell CR5000 Specifiche Pagina 90

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 238
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 89
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 dimensioned 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 CR5000.
Syntax
Public
(
list of [dimensioned] variables that make up the Public Table
)
Remarks
More than one Public statement can be made.
Vedere la pagina 89
1 2 ... 85 86 87 88 89 90 91 92 93 94 95 ... 237 238

Commenti su questo manuale

Nessun commento