Re: TIB: Not using goto.


[Prev][Next][Index][Thread]

Re: TIB: Not using goto.




Christopher Robin MacDougald wrote:
> 
> Jody,
>         Why would you suggest not using a goto? It works fine when I've used
> it. You just have to be very careful about where you use it and how
> often. I own an 85 and yes there are instances where I can see this as a
> negative thing but on a whole it's really not that bad. Oh one more
> thing about my programs I used matrixes on the Calculator Man and a few
> others but once they where finished (as long as you don't press on and
> quit) it would shrink them back to 1,1. I also changed graphing options
> and have them go back to the factory default when you exit the programs.
> I think it should be a part of every good program to include help and
> return to the defaults so that even a person with few calc knowledge can
> not worry about "messing up" their calculator when they play a game.
> Happy programming,
> Christopher Robin MacDougald

I use lots of goto's  in my stuff too, but you have to be careful - 
are the majority of yours inside loops? The biggest problem is with 
memory. If you keep skipping ends the calc will run out of mem much, 
much faster. Now the other problem that you migh run into has to do 
with various commands. I can't remember what exactly the situation 
was, but this one came up and bit me once. I had a goto in the middle 
of a For( loop, which was in turn nested inside a While loop. The goto 
jumped outside both loops. Looked kinda like this;
:While X<A
:X+1->X
:For(C,1,X
:If pxl-test(Y,C
:Goto 1
:End
:End
:Lbl 1

Hmmm....bad example, maybe. Well, think about that, though. It is 
possible to end up in a position where the calc reads an end, and it 
treats it like the end from a totally different loop. Doesn't happen 
very often, but if it does happen, it can take a while to figure out 
what's happening. Trust me - don't put goto's INSIDE anything with an 
end.

Jody Snider
jody1@alaska.net


Follow-Ups: References: