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 trialSwapnil Kapse
1,162 PointsAssign an NSNumber literal with a value of '4' to the variable 'thing'. How to solve this?
How to code
Assign an NSNumber literal with a value of '4' to the variable 'thing'. Even though, sentence is written as 'NSNumber *thing = @4;' I am getting error as in earlier challenge's answer is 'id thing = 4;'
Hence, thing is getting defined twice. Please suggest
2 Answers
Michael Hulet
47,913 PointsI haven't looked at the challenge, but from what I've read here, it sounds like all you'd need to do is reassign the thing
variable to an NSNumber
literal of 4
, like this:
thing = @4;
Stephen Whitfield
16,771 PointsNSNumber (literal) example:
NSNumber *numberEight = @8;
Swapnil Kapse
1,162 PointsEven though, sentence is written as 'NSNumber *thing = @4;' I am getting error as earlier challenge's answer is 'id thing = 4;'
thing is getting defined twice. Please suggest