Gosub/Return

Gosub was useful in the bad old days when all variables were global and Select Case didn’t exist. But why Gosub, Return, and On Gosub remain in Visual Basic is beyond me. Perhaps they were left in for compatibility of some kind, although I find it hard to imagine a procedure using these statements that one could port from an earlier Basic.

I’ve heard it argued that it’s more efficient to use Gosub and Return than to use subs and functions. Well, yes, but technically you could write all your code using only If, Then, and Goto—that would be more efficient still, if you ever got it debugged. If Gosub is what it takes to write efficient code in Basic, I’ll take C. Fortunately, it’s not.