Gosub or functions?

Blitz3D Forums/Blitz3D Beginners Area/Gosub or functions?

@MSW

Thank you for that very informative, high quality post!

Personally, I agree with Shambler that the speed difference between functions and gosubs is negligible and that the fact that functions make you pass in values can make them a bit easier to debug and understand. On the other hand, if you decide not to pass in a zillion variables and use globals instead, it will be equally unreadable. Also, you can't declare a variable as global inside a function.

As for goto, one very useful feature is that they can be used inside functions. I find myself using them to skip to the end of a function to do cleanup things before exiting.

Overall, I say use whatever works for you.