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
Derek Southworth
679 PointsUse NSLog to print out the value of the variable 'thing'. The output should look like: "thing = 4".
Stage six quiz question 3/3: "Use NSLog to print out the value of the variable 'thing'. The output should look like: "thing = 4"."
I am completely stuck on this. Not sure why. An NSLog shouldn't be that difficult, but Im stuck. My previous code for this:
id thing = nil; thing = @4;
4 Answers
Jed Bradshaw
6,053 PointsTry this:
NSLog (@"thing = %@", thing);
Derek Southworth
679 PointsThat was right! Thanks so much!
linas mickevicius
1,407 Pointsif that thing variable is a number then the following should work: NSLog(@"thing = %d",thing);
Michael Castro
11,959 PointsNSLog(@"thing = %a",thing);
Derek Southworth
679 Points^^^ Nope that didnt work either. Previous questions in quiz: (1)"Declare a variable named "thing" to type id and initialize it to nil." Which was id thing = nil; (2)"Assign an NSNumber literal with a value of "4" to the variable "thing." Which was thing = @4;