View Single Post
Old 17 February 2021, 15:46   #5
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 5,311
There's nothing wrong with a Gosub (or even a Goto, for that matter) if it's used responsibly and with good reason They're a bit old skool and can lead to difficult to debug situations, weird bugs and tricky to follow code, but they're also faster than using functions, and in game terms on stock hardware, that speed difference can be important.

Make sure every Gosub is terminated with a Return, and that if you leave the Gosub for anything, you Return back into it before Returning to the previous point. If you really need to, you can Pop out of a Gosub stack, but I think such a situation could easily be handled some other way.
Daedalus is offline  
 
Page generated in 0.04990 seconds with 11 queries