Discussion Forums at Tactical Neuronics

Re: Mixing Gosubs and Gotos From:
John Reder


LOL! Yes, there is a nesting stack limit of 100 levels deep. Right around the 100th missed return (Goto) your Cybug's logic lost its ability to store (remember) from which it came.

Happy Holidays!

> What are the "rules" for nesting gosubs and gotos?
> I (like I'm sure most of you) have several branches like:
> Long Range Scan
> GoSub LongScan #scan
> In one situation I want the code called by GoSub to run and then return back to the proceeding line, but in another, the code is quite extensive and I just want to "GoTo" the first line of my "Main Loop" and never use Return. In that case will the next Gosub / Return work the way I want?
> In my current bug, mixing the Gosubs with no returns seems to work OK, but I don't like doing it. It's not very clean programming. Also, my bug seems to freak out after about 300 clicks and just runs straight until it hits a wall, ignoring enemies and all my wonderfull logic routines. :) I'm wondering if I'm overflowing some sort of buffer with all my unresolved returns?
> Thanks,
> Jason

This message is a Reply to: Mixing Gosubs and Gotos from Jason Hect

Replies to this message:

© 2001, John A. Reder.