Labels



* M Payne * Spectrum

* Milton, Stoke-on-Trent



This program allows labels to be used on the Spectrum. It

is written in such a way that it may be used with a line

renumberer thus adding greater versatility to program

development. By using meaningful labels you can forget

about line numbers and settle down to writing some read-

able, structured programs. Points to note:



* A label is stored as a variable containing the value of

  the line number on which it appears.

* A label is defined by a Rem statement followed by an

  asterisk followed by the label name.

* No other text may appear with a label - each label must

  have a line of its own.

* This program must precede any program using labels.

* Labels must not be longer than 20 characters.



  The program is searched for label declarations, and when

found, the label name is poked into the Let statement on

the second line. This statement is then executed and the

search continues until the end of the program.

Note - the Go Sub statement, and the For z=0 TO 0 Step 0

statement are methods of avoiding direct jumps involving

line numbers.

  [What the article didn't mention, but was clear from the

listing, is that the program as printed also included two

examples of labels. If you run it, you will see that it

stops at the second label - list the program to see why.

Then GO TO 1000 to see that the first label has been set

correctly. Do not use RUN 1000, obviously, because that

will erase the labels again.]