MM Basic labels


Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9203
Posted: 12:15am 28 Jun 2023      

Well, it does depend on what you are doing to some extent!  

As a previous BIG user of GOTO, where I would GOTO all over the place, I can say that I agree that is a bad idea, and more structured programming with a main loop, IF/THEN/ELSE's etc, are the way to go.  It makes debugging code MUCH more easy, if you have some kind of "Flow" to the code, rather then jumping all over the place with GOTO, which can be a debugging nightmare with a large code.

But it can be hard to drop old habits.  

In your case, the code is not huge, so you get away with it fine.

You could "Modernize" your code by putting it all inside one IF/THEN/ELSE like this:


FOR I=?????? (we don't have this line of code, but put it here)
 IF S>Q THEN 'Do the CCC1 code...
   C(I)=1
   A(I)=0
 ELSE 'Do the CCC2 code...
   (I)=0
   A(I)=A(I)+C(I+1)
 ENDIF 'Now do the CCC3 code no matter what happens above...
 C(N)=1
NEXT I


Untested, but should do the same thing, and does away with hopping around with GOTO's.  
Edited 2023-06-28 10:18 by Grogster