Doubt in goto statement

Discussion in 'iOS Programming' started by iphonejudy, Mar 22, 2009.

  1. iphonejudy macrumors 6502

    iphonejudy

    Joined:
    Sep 12, 2008
    #1
    I used goto statement as below


    News:

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

    Go to News;

    But i got errors("News label used but not defined")
     
  2. Jeremy1026 macrumors 68020

    Jeremy1026

    Joined:
    Nov 3, 2007
    #2
    Judging by the code you posted...actually, its impossible to know what's wrong from what you had.
     
  3. admanimal macrumors 68040

    Joined:
    Apr 22, 2005
    #3
    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.
     
  4. mccannmarc macrumors 6502

    mccannmarc

    Joined:
    Aug 15, 2008
    Location:
    Manchester, UK
    #4
    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
     
  5. kalimba macrumors regular

    Joined:
    Jun 10, 2008
    #5
    I think the error is the compiler's way of saying "Please, for goodness' sake, do not use the goto statement!" :D
     

Share This Page