I was wondering if any one here knows how to use Goto, it would be a help of you could tell me.
I was wondering if any one here knows how to use Goto, it would be a help of you could tell me.
Dont use goto, period. Use a loop for or whileloop instead.
STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.
while i disagree with shakti, goto's should be avoided till you are a well seasoned programmer and know the in's and out's of the language and how and where to use a goto in the rare case you need one, i recommend finding another solution untill you know for sure when and where you need one... and if you dont already know how to use one you probably dont know...
on a side note this belongs in the C or C++ forum...Code:int main(void) { goto GOTO_LABEL; // skipped code... GOTO_LABEL: // code... return 0; }
Last edited by no-one; 05-20-2005 at 02:53 PM.
ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.
Thanks. I need this to make a Text based game. When I use basic, Goto is what I use most, it's all I know how to use for this. Such as, the inputer makes a desion, then the Goto sends them to the next desion and so on. I don't know if any other loops can do that.
>> I don't know if any other loops can do that.
If statements and for/while loops most certainly can and are definately worth learning. GOTO should be more of a last resort.
I see what your saying, I've just been thinkin too big...or small.
Correct me if I'm wrong, but it has few uses:Originally Posted by RedRookie[edit]It's as useful as a "Branch Always" to an assembly programmer, but used where the C languages don't quite provide it automatically.
- Common exit/cleanup code from a function.
- Breaking out of nested loops without extra stuff.
- Breaking a loop from a switch (without extra stuff).
Last edited by Dave_Sinkula; 05-21-2005 at 09:40 PM.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*