[TIB] Re: Question


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

[TIB] Re: Question




> 
> Yeah, I suppose I got a bit overzealous with my bashing of Goto and 
> Lbls, didn't I. :) The big danger with those is jumping out of a loop, 
> or out of an If Then statement. I do know that you get the mem back 
> after the program's done, etc. Using those commands specifically to loop 
> something is just a poor way of coding a loop on the calc, and that's 
> the point I was trying to make.
> 
> I  just have it burned in my mind that Goto = bad.
> 
> -c.j.w.
> 

Making a loop with Goto means that every time the end of the loop (in
this case a Goto) is encountered, TI-OS will search for the corresponding
Lbl, starting at the begin of the program, and search towards the end of
the prog. Doing a loop the proper way (For, While, Repeat) makes the OS
store the location of the begin of the loop, so when it reaches the end
(in this case an End statement) all it has to do is "load" the old position
and resume execution there. This is *much* faster.
I forget his name, but somebody once wrote a book about "goto-less"
programming. I don't agree that Goto is always evil, but yes, you should
avoid it where possible.

Rob van Wijk

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!




References: