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 Objective-C Basics (Retired) Foundation Framework NSNumber

How do I declare the variable planck NSNumber with the value 6.626!!?

I've tried everything I can think of!!

4 Answers

you need to use NSNumber literals. to assign an NSNumber literal you use the following syntax

NSNumber *someNumber = @25;

so to assign a literal to planck you would use:

NSNumber *planck = @6.626;

It took me forever to get this as well!! It will actually only accept the second way it showed to assign the value from the previous video, the first and third ways don't work.

Just had the same problem spent 5 minutes trying to workout why it didn't like my syntax before finding this forum post. Thank you :)

NSNumber *planck = [[NSNumber alloc] initWithFloat:6.626];

Thanks but that's what I did and it's still telling me it's wrong.

Seems like that Code Challenge wants some specific syntax from you that was presented in previous videos. Check them out and retry.