Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Objective-C Basics (Retired) Advanced Objective-C Dynamic Typing

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

What is wrong with my code? (I've tried for days )

I can't figure out what is wrong with my code:

NSArray *thing = [[NSArray alloc] init];
for (id nil in thing) {
    NSLog("%@", nil);
}

Here's what the problem the preview shows:

expected statement

}

^ 6 errors generated.

When I deleted the curly braces and replaced it with a semi-colon on the second line of code I got this error:

expected ')'

note: to match this '('

for (id nil in thing);

  ^

5 errors generated.

Anyway, getting rid of the curly braces ruins the code.

P.S. I tried to make this post readable but it wasn't working.

obey me
obey me
1,135 Points

what you were trying to do

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

I'm trying to complete the code challenge listed at the bottom of my question.

J.D. Sandifer
J.D. Sandifer
18,813 Points

Use three ` characters (same key as the tilde, above tab) instead of three ' characters (single quote) to block out your code. That will make it look good in the forum here.