Section 7. Installation
134
When a
Function()
function returns a pointer, apply the ! operator to the function
call, as shown in the following example:
Function
ConstrainFunc(Value As Long,Low As Long,High As Long)
As Long
If
!Value < !Low
Then
Return
Low
ElseIf
!Value > !High
Then
Return
High
Else
Return
Value
EndIf
EndFunction
‘Call within program
FuncFltRes = !ConstrainFunc(@FltVal,@FltLow,@FltHigh)
7.6.3.5 Declaring Arrays
Related Topics:
•
Declaring Arrays
(p. 134)
•
VarOutOfBounds
(p. 473)
Multiple variables of the same root name can be declared. The resulting series of
like-named variables is called an array. An array is created by placing a suffix of
(x)
on the variable name. X number of variables are created that differ in name
only by the incrementing number in the suffix. For example, the four statements
Public
TempC1
Public
TempC2
Public
TempC3
Public
TempC4
can simply be condensed to
Public
TempC(4).
This statement creates in memory the four variables
TempC(1)
,
TempC(2)
,
TempC(3)
, and
TempC(4)
.
A variable array is useful in program operations that affect many variables in the
same way. CRBasic example
Using a Variable Array in Calculations
(p. 135)
shows compact code that converts four temperatures (°C) to °F.
In this example, a
For/Next
structure with an incrementing variable is used to
specify which elements of the array will have the logical operation applied to
them. The CRBasic
For/Next
function will only operate on array elements that
are clearly specified and ignore the rest. If an array element is not specifically
referenced, as is the case in the declaration
Dim TempC()
CRBasic references only the first element of the array,
TempC(1)
.
See CRBasic example
Concatenation of Numbers and Strings
(p. 304)
for an
example of using the
+=
assignment operator when working with arrays.
Summary of Contents for CR800 Series
Page 2: ......
Page 4: ......
Page 6: ......
Page 32: ......
Page 34: ......
Page 54: ......
Page 92: ......
Page 310: ......
Page 446: ...Section 8 Operation 446 8 11 2 Data Display FIGURE 100 CR1000KD Displaying Data ...
Page 448: ...Section 8 Operation 448 FIGURE 102 CR1000KD Real Time Custom ...
Page 449: ...Section 8 Operation 449 8 11 2 3 Final Storage Data FIGURE 103 CR1000KD Final Storage Data ...
Page 450: ...Section 8 Operation 450 8 11 3 Run Stop Program FIGURE 104 CR1000KD Run Stop Program ...
Page 452: ...Section 8 Operation 452 FIGURE 106 CR1000KD File Edit ...
Page 456: ......
Page 462: ......
Page 523: ...Section 11 Glossary 523 FIGURE 116 Relationships of Accuracy Precision and Resolution ...
Page 524: ......
Page 526: ......
Page 556: ......
Page 558: ......
Page 560: ......
Page 597: ......