r/visualbasic • u/abovethelinededuct • May 05 '24
GoTo?
As I've been going through my studies I saw that GoTo still exists in VB. Could someone provide a real life use case for it? The one in the book could have been handled by a simple If Else statement.
1
Upvotes
View all comments
Show parent comment
1
u/BCProgramming May 07 '24
Yes, Djikstra's entire essay was largely about the use of goto and gosub to try to mimic functions, because there was obviously no clear control flow; It also meant that you could jump anywhere so you'd have goto's or gosubs hopping right in the middle of a "routine" and stuff, which is certainly not something you can even try to do these days. The complaints were almost about the things people were writing in BASIC more than goto being available at all; after all it's a pretty direct equivalent to JMP instructions, and he never railed against Assembly language to my understanding.
All that said though, if you do need goto (or using a flag even) to deal with logic involving breaking out of a set of nested loops, it does suggest that perhaps the function is a bit complicated.