Jean-Claude Touzin
C.P.41 La Sarre Prov. Québec
Canada J9Z 2X4 Tél. [phone number omitted]
To: UPDATE MAGAZINE
1317, Stratford Ave., Panama City, FL 32404
9.2.89
Dear Bill,
UPDATE jan. 89 was my second issue and I like the open spirit and warm feeling that you put in this mag.
As a small contribution, I send you a new listing for the QL index program that appeared on page 61, with some commentaries.
Concerning the way to terminate a loop in superbasic, the standard is to use END FOR or END REPeat. NEXT is used when you want to terminate a FOR loop for ex. before the END FOR. In this case, QDOS will jump from the NEXT to the FOR statement.
You can also use EXIT to jump after the END FOR or END REPeat statement (see listing for example of this).
Concerning the linefeed, I removed the c of SER1, which make my printer always print on the same line. As is, I do not have to change dipswitch for going to and from QUILL.
Another thing to note is that you don’t need to repeat the DIM statement for each variable that you define. Also notice how powerful is the INPUT statement in Superbasic: you can concatenate(?) all sort of thing in the prompt, plain text, numeric variable, string variable and even loop control variable(see listing).
Lastly, when you want to repeat something in Superbasic, the easy way is to englobe everything in a REPeat END REPeat loop, instead of GOTO. That’s what I have done to your small program.
I hope that my “Frenchglish” is not too hard to decipher…
QLy Yours,
Jean-Claude Touzin.
See “INDEX PRINTER” in the January 89 UPDATE – Same Program But This is Better. BJ Thanks J.C.!
5 REPeat index
10 CLS:CLS#2: LIST
20 INPUT "Number of index' titles? ";a
30 DIM a$(a,28),b$(a,12)
100 FOR n=1 TO a
110 INPUT "Enter index' title no " & n & " (x to end):"a$(n)
120 IF a$(n)="x": a=n-1: EXIT n
130 INPUT"Enter pages ";b$(n)
140 END FOR n
500 INPUT "Enter first tab ";tb
510 OPEN#4,ser1: BAUD 9600
520 FOR n=1 TO a
530 PRINT#4;TO tb;a$(n);TO (tb+28);b$(n)
540 END FOR n
550 INPUT"Number of linefeed ";x
560 IF x>0: FOR n=1 TO x:PRINT#4;
570 CLOSE#4
580 END REPeat index
Freebie
Need a QL Power Supply Module? – Since having a “Outside Pwr Sup” installed, and I don’t have a Mustache to trim – You can have my old QL pwr supply for shipping cost of about $5.00. FIRST call gets it. – Call UPDATE. – BJ (Ideal for Running a Mustache Trimmer) (OR even a QL)
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.