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

Use 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

Try this:

NSLog (@"thing = %@", thing);

That was right! Thanks so much!

if that thing variable is a number then the following should work: NSLog(@"thing = %d",thing);

NSLog(@"thing = %a",thing);

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