Thread: goto
View Single Post
  #1  
Old 02-03-2008, 03:49 PM
projectigi projectigi is offline
Registered User
Join Date: Jan 2004
Posts: 403
projectigi is an unknown quantity at this point
Quote:
Originally Posted by cbkbud View Post
goto would be a complete nightmare when trying to read code.

Think about it; in languages such as BASIC they have it, but that is not object oriented, and does not have functions.

Think about this ...

function foo() is called. It goes to CAT which is in function bob(), which goes to DOG which is in function moo() ... then eventually does it go back to the original function foo()? Or does it keep advancing?

And THEN, what happens if you GOTO a function, and then the function ends? Your whole script has stopped.

That's not the way GS2 is supposed to work. After you call one function, it goes back to the function it was in before when it's completed. This is how it should work. goto would completely screw this up.

In Java, goto is actually a reserved variable name (you cannot name a function or variable it). I guess they REALLY don't like it.

If you need to quit a loop, return is your best option, or to use a variable I suppose.

Simply structure your code better is my suggestion.
C++ is OOP and they have it :P
__________________
Reply With Quote