Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Matej Lukášik
27,440 PointsDynamic Typing Code Challenge Unsolved :-(
Can anyone help me with this code challenge? https://teamtreehouse.com/library/dynamic-typing
It goes like this: "Declare a variable named "thing" of type 'id' and initialize it to 'nil'."
This works in Xcode:objective-c
id thing = @[@"nil"];
This works in Xcode:objective-c
id thing = @"nil";
but when I submit it to the Code Challenge, it says:"Bummer! Did you declare the variable 'thing' and set it to 'nil'?"
What am I doing wrong and how should I solve this challenge?
3 Answers

Holger Liesegang
50,595 PointsHi Matej, try using id without @ as it is already implicit.

Raissa de Guzman
645 PointsHi Matej, When you set it up as id thing = @"nil"; you actually defined |thing| as a string object with the value "nil" (i.e. the string, "nil") and not the actual nil value :)
id thing = @"nil" works on x-code because |id| can be passed any type of object; therefore, it is syntactically correct and will compile.

Matej Lukášik
27,440 PointsThanks a lot! This worked: id thing = nil; btw, what does that @ stand for? what does it say? yup, I'm a beginner :-)

Véronique Bellamy
20,810 PointsWhen someone answers your question and helps you resolve the problem, please choose a "Best Answer". This way, the person who gave you the answer gets extra points and it encourages participation.
Oh, and welcome to Treehouse. ;)

Holger Liesegang
50,595 PointsHi Jessica, congrats for your new status as a moderator :-)

Véronique Bellamy
20,810 PointsThanks. ^_^;;