Specifications

Section 5. Program Declarations
5-8
constants (i.e., do not contain a variable) into some of the
variables. If a constant is passed, the “variable” it is
passed to becomes a constant and cannot be changed by
the subroutine. If constants will be passed, the subroutine
should be written to not try to change the value of the
“variables” they will be passed into.
statementblock Any group of statements that are executed within the body
of the Subroutine.
Exit Sub Causes an immediate exit from a Subroutine. Program
execution continues with the statement following the
statement that called the Subroutine. Any number of Exit
Sub statements can appear anywhere in a Subroutine.
End Sub Marks the end of a Subroutine.
A Subroutine is a procedure that can take variables, perform a series of
statements, and change the value of the variables. However, a Subroutine can't
be used in an expression. You can call a Subroutine using the name followed
by the variable list. See the Call statement for specific information on how to
call Subroutines.
Caution Subroutines can be recursive; that is, they can call themselves to
perform a given task. However, recursion can lead to strange
results.
Subroutine Example
'CR3000
'Declare Variables used in Program:
Public RefT, TC_C(4), TC_F(4), I
'Data output in deg C:
DataTable (TempsC,1,-1)
DataInterval (0,5,Min,10)
Average (1,RefT,FP2,0)
Average (4,TC_C(),FP2,0)
EndTable
'Same Data output in F :
DataTable (TempsF,1,-1)
DataInterval (0,5,Min,10)
Average (1,RefT,FP2,0)
Average (4,TC_F(),FP2,0)
EndTable