ok, say I am using the goto command, how do I use it effectively.
Every time I try it tells me I have an error or two.
If anyone can help me I would greatly appreciate it,
thx.
ok, say I am using the goto command, how do I use it effectively.
Every time I try it tells me I have an error or two.
If anyone can help me I would greatly appreciate it,
thx.
hello
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
The most effective way to use it is not to =]
Seriously, goto, at its best, is only AS simple as loop/condition structures (do..while, while, for, if, switch) and is never simpler. It is never the best method for solving a problem and is almost always a problem.
Even using gotos which are exactly equivalent to a loop structure is not recommended because of scope. Variables declared in a loop have scope only within the loop -- not so with gotos. Further, the use of gotos negates some of the compiler's ability to generate warnings.
If you want to learn C++, you should pretend goto does not exist. Goto-style code, aka "spaghetti code", is hideously bad style. It is harder to read, harder to debug, and harder to write.
Goto is something you use only in languages where there IS nothing else. In C/C++, you don't need to learn how to use it -- you learn how NOT to use it!
There is nothing that you can do with goto that you can't do with a for loop or while loop. Seriously, there is no need whatsoever to use goto. It is really bad practice and it is very inefficient.
Ramble on...
true, but goto's can accomplish some things more effeciently on rare occasions...
ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.
>>true, but goto's can accomplish some things more effeciently on rare occasions...<<
Perhaps, but not really enough to warrant its use when other options are available.
Ramble on...