AOH :: STRBASIC.TXT|
Making your 64 Basic programs look more structured
The following programs and tips are examples of ways to make your
BASIC programs look more structured.
First of all it is always best if you are writing a large program to
break it up into several subroutines. These subroutines could make use
of variables so as to function differently depending on what part of
the program is calling them.
To give your subroutine an appearently REMless title do the
1) Enter the REM on desired line
followed by a quote (").
2) Press <CR>
3) Cursor up to that line and
to the right of that quote
turn on reverse mode (CTRL
4) Now press SHIFT M and SHIFT Q.
5) Press the quote again then
6) Enter the comment you wish to
be entered as a REMark.
7) Press quote and then delete
9) Next SHIFT Z.
10) Finally, <CR>.
That's all there is to it! I can't take credit for this one. It
belongs to Luis Pistoia of Argentina.
To produce the indentation effect found in certain PASCAL and C
editors, use the colon (:). That's all! The following give examples of
what I mean:
10 :FOR I = 1 TO 10
12 : FOR J = 1 TO 10
14 : FOR K = 1 TO 10
16 : PRINT
18 : PRINT
20 : PRINT
22 : PRINT K,
24 : PRINT J,
26 : PRINT I
28 : PRINT
30 : PRINT
32 : PRINT
34 : NEXT K
36 : NEXT J
38 :NEXT I
10 :REM THIS IS AN EXAMPLE IN
12 :REM STRUCTURED PROGRAM DESIGN
16 :BEGINNING=1: FINISH=12
18 :FOR LOOP = BEGINNING TO FINISH
20 : PRINT "LOOP #"; LOOP
22 : PRINT: PRINT: PRINT
24 :NEXT LOOP
Also, in PROGRAM #2 I use long variable names to make the program more
readable. Naturally BASIC will only read the first two characters of
the variable. For example the BASIC interpreter will refer to the
variable BEGINNING as BE.
I hope these hints are helpful. If they are, pass them on!
The entire AOH site is optimized to look best in Firefox® 3 on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986- AOH
We do not send spam. If you have received spam bearing an artofhacking.com email address, please forward it with full headers to firstname.lastname@example.org.