Sinclair QL Beginner's Manual page 121

Hide thumbs Also See for QL:
Table of Contents

Advertisement

3. Sort the array.
4. Pause to check that everything is in order
5. Delete file 'phone'.
6. Create new file 'phone'.
This is all the program needs to do but the new file should be immediately checked using:
COPY mdv1_phone TO scr
Any further necessary checks should be carried out then:
DELETE mdv2 phone
COPY mdv1_phone TO mdv2_phone
COPY mdv1_phone TO scr
DELETE mdv1_phone_temp
The above operations complete the process of substituting a sorted file for the original unsorted one
in both master and back-up files.
ARRAY PARAMETERS
In the following program we illustrate the passing of complete arrays between main program and
procedure. The data passes in both directions.
In line 40 the array row holding the numbers 1, 2, 3 is passed to the procedure, addsix. The
parameter come, receives the incoming data and the procedure adds six to each element. The array
parameter, send, at this point holds the numbers 7,8,9.
These numbers are passed back to the main program to become the values of array, black. The
values are printed to prove that the data has moved as required.
Program
100 REMark Pass Arrays
110 DIM row(3),back(3)
120 FOR k = 1 TO 3 : LET row(k) = k
130 addsix row,back
140 FOR k = 1 TO 3 : PRINT ! back(k) !
150 DEFine PROCedure addsix(come,send)
160
FOR k = 1 TO 3 : LET send(k) = come(k) + 6
170 END DEFine
789
Output

Advertisement

Table of Contents
loading

Table of Contents