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

Nir Ohayon
Nir Ohayon
2,399 Points

Foundation framework challenge

Something is wrong here:

the Q is "Declare another variable named 'planck' of type NSNumber and assign it the value 6.626."

I did it in a bunch of different ways that should work and it still tells me "Bummer! Make sure you created a NSNumber with the correct variable name, and check your syntax!"

my answers variations was:

1 NSNumber *planck = @6.626;

2 NSNumber *planck = [NSNumber numberWithFloat: 6.626];

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

Whats going on??

6 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

I just tried NSNumber *planck = @6.626; and it worked for me.

why isnt any of these working

Nir Ohayon
Nir Ohayon
2,399 Points

I found the answer, i had to change it to NSNumber *planck = [NSNumber numberWithDouble:6.626];

which is kind of weird since in the video he used 'numberWithFloat'...:/

Alexander Palm
Alexander Palm
16,695 Points

Declare another variable named 'planck' of type NSNumber and assign it the value 6.626.

I tried NSNumber *planck = [NSNumber numberWithFloat:6.626];

Is that not a correct answer?

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

I have amended the code challenge and that answer should work.

Alexander Palm
Alexander Palm
16,695 Points

Thanks Amit. Love your courses!

I also went for NSNumber *planck = [NSNumber numberWithFloat:6.626]; like in the tutorial, codechallange spat my code right out again.. It works perfectly well in Xcode..

Marie Veverka
Marie Veverka
12,117 Points

Mine wouldn't work until I changed it to NSNumber *planck = [NSNumber numberWithDouble:6.626]; as well . . .