help with 2 errors when coding.. help would be nice

Discussion in 'iOS Programming' started by koopa35, Feb 19, 2010.

  1. koopa35 macrumors 6502

    Joined:
    Aug 7, 2008
    Location:
    Los Angeles, CA
    #1
    hello im just starting out on coding im using learn obj c on a mac. im doing one of the programs and i have followed step by step but yet i still produce two errors. i dont know what they mean of how to fix them.

    can someone explain the error code and how to solve that type of error for the future???
     

    Attached Files:

  2. plinden macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #2
    Try moving the final } to before the boolString function.
     
  3. Gepper macrumors member

    Joined:
    Dec 7, 2009
    #3
    The error code you get should give you a clue ;) What it says is "Function within a function is not permitted". In your case it means you forgot to end your comparison function with a }
     
  4. koopa35 thread starter macrumors 6502

    Joined:
    Aug 7, 2008
    Location:
    Los Angeles, CA
    #4
    i see but im not sure where to put the } again im new to this
    i have tried everything I know what the limited knowledge i know. but ill keep trying :p
     
  5. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #5
    See post #2. If that still doesn't make sense, it's time to step away from the real code and go learn the basics of Objective-C.
     
  6. koopa35 thread starter macrumors 6502

    Joined:
    Aug 7, 2008
    Location:
    Los Angeles, CA
    #6
    this is basics of objective c book. whats funny is when i write the code down line for line i had more errors than 2. if i copy and paste same code its goes through fine. the error codes arent that helpful if its not saying it expects something. it would be nice for you to correct my error so I can see what i did wrong. but again this is basic of objective c . what ever page this is in the very first part of the book
     
  7. plinden macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #7
    The error message is perfectly clear. You're not allowed to nest functions. Part of learning to code is learning to interpret error messages. I'm not an Objective-C programmer, but I still understand what that means.

    If you're getting errors typing in the code compared to copy and pasting, you're obviously not typing it in correctly. It must be exactly the same.

    I've already corrected it. Move the final } to before the boolString function.

    If that's not clear ... go to the end of the file, to the last }. Delete it. Go to the line before the boolString function. Add }. Recompile. That doesn't mean the code is correct. It might just fix this particular error and produce another error. As I said, I'm not an Objective C programmer, so I can't compile what you have in my head.

    Edit: Googling for "fnested-functions" gives this as the first result:
    http://developer.apple.com/mac/library/technotes/tn2006/tn2161.html

    Read and try to understand.

    Edit 2: Actually, the second result is likely more useful: http://forums.macrumors.com/showthread.php?t=653636
     
  8. koopa35 thread starter macrumors 6502

    Joined:
    Aug 7, 2008
    Location:
    Los Angeles, CA
    #8
    Solved

    thank you for the help i fixed the issues.. sometimes its hard to see the errors when everything looks the same
     
  9. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #9
    I won't repeat plinden's advice since it was very good but I will add that the above kind of information is far too vague. If you can provide the exact book title and the exact page number, those who might happen to have that book will be better equipped to provide some assistance. That is, you're better off helping us so that we can help you.
     
  10. koopa35 thread starter macrumors 6502

    Joined:
    Aug 7, 2008
    Location:
    Los Angeles, CA
    #10
    I only mention the book because you told me to leave the code alone and go back to the basics of objective c. I was only pointing out that , thats exactly what im doing is the basics of objective c. the error code they give are new to me as i have never seen them and didnt know what they really meant. but upon further review the } was missing but since it all looks the same i didnt know it was missing. Ill take your advice next time if i refer to the book : Learning Objective C on mac by Mark Dalrymple. and again thanx for your input as well
     

Share This Page