Discussion Forums at Tactical Neuronics


Mixing Gosubs and Gotos From:
Jason Hect

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

Replies to this message:


© 2001, John A. Reder.