PDA

View Full Version : Doubt in goto statement




iphonejudy
Mar 23, 2009, 01:26 AM
I used goto statement as below


News:

-------;
-------;

Go to News;

But i got errors("News label used but not defined")



Jeremy1026
Mar 23, 2009, 08:48 AM
Judging by the code you posted...actually, its impossible to know what's wrong from what you had.

admanimal
Mar 23, 2009, 10:18 AM
As far as I know, the appropriate syntax for a goto statement is "goto News;" not "Go to News;". Do you reallllly want to use a goto statement though? Chances are there is a much less archaic way to do whatever you are trying to do.

mccannmarc
Mar 23, 2009, 11:54 AM
Why on earth are you using goto in such a simple piece of code? Using goto is considered bad programming practice in C/C++/Objective-C (in fact most languages besides archaic languages and assembler) these days and can easily be avoided with the use of functions

kalimba
Mar 23, 2009, 12:53 PM
As far as I know, the appropriate syntax for a goto statement is "goto News;" not "Go to News;". Do you reallllly want to use a goto statement though? Chances are there is a much less archaic way to do whatever you are trying to do.

Why on earth are you using goto in such a simple piece of code? Using goto is considered bad programming practice in C/C++/Objective-C (in fact most languages besides archaic languages and assembler) these days and can easily be avoided with the use of functions
I think the error is the compiler's way of saying "Please, for goodness' sake, do not use the goto statement!" :D