|
Enhancing the HELLO Program |
Now we will take the pre-existing code from the HELLO program and we will modify it. Instead of erasing the existing code, we will just add lines before. To do this, go to the beginning of the line you wish to move down, hit the 2nd key to enable the yellow commands on the keypad. To insert a line, press the DEL key (the INS command is right above the DEL key; this command inserts lines, spaces, etc.) We will be using the Lbl (Label) and Goto commands during this lesson, which may be found under the CTL menu when the PRGM button is pressed during the EDIT mode. Using these concepts, modify the existing code to look like the code below:
:Lbl 0 :Disp "HELLO" :Goto 0
Now run the program. Notice that this program also displays "HELLO," but when it reaches the point where the old program ended (the Stop command) it sees the Goto 0 command. The program searches through the program looking for a label (Lbl) with the name "0." It finds this label at the very beginning of the document, and tells the program to continue computing at this point.
(Note: the program will continue to run until you stop it or there is an overflow. To end a BASIC program like this one: Press the ON key on the keypad. This allows the user to break the code, thus ending programs without an end.)
|
|
|