Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

koopa35

macrumors 6502
Original poster
Aug 7, 2008
433
0
Los Angeles, CA
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???
 

Attachments

  • Screen shot 2010-02-19 at 11.24.04 PM.jpg
    Screen shot 2010-02-19 at 11.24.04 PM.jpg
    27 KB · Views: 80
  • Screen shot 2010-02-19 at 11.23.45 PM.jpg
    Screen shot 2010-02-19 at 11.23.45 PM.jpg
    76.2 KB · Views: 113
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???

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 }
 
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 }

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
 
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.

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
 
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

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: https://forums.macrumors.com/threads/653636/
 
Solved

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: https://forums.macrumors.com/threads/653636/

thank you for the help i fixed the issues.. sometimes its hard to see the errors when everything looks the same
 
this is basics of objective c book. ... what ever page this is in the very first part of the book
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.
 
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.

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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.