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 trialMichael Nees
1,070 PointsDynamic Typing
Got a bit stuck with this one...
Declare a variable named thing of type id and initialize it to nil.
NSArray *thing = @(@id, @"nil"];
What is wrong?
2 Answers
Jimmy Hsu
6,511 PointsI think you may be complicating it more than you need to.
From what I can see the question asking, it is simply a matter of declaring a simple variable.
id thing = nil;
The syntax format goes "type" "name" = "value";
Where you went wrong was in instead of declaring a variable with the type of id, you went further and created an NSArray instead that contained invalid values of an invalid object (the @id, closest thing I could image to being valid would be @"id" as a string) and a string of "nil".
Michael Nees
1,070 PointsMany thanks Jimmy for your help! ...something we make life harder than it is...