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 trialNir Ohayon
2,399 PointsFoundation 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
Treehouse Guest TeacherI just tried NSNumber *planck = @6.626;
and it worked for me.
Nir Ohayon
2,399 PointsI 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
16,695 PointsDeclare 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
Treehouse Guest TeacherI have amended the code challenge and that answer should work.
Alexander Palm
16,695 PointsThanks Amit. Love your courses!
Nir Ohayon
2,399 PointsThanks Amit.
Magnus Braathen
7,726 PointsI 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
12,117 PointsMine wouldn't work until I changed it to NSNumber *planck = [NSNumber numberWithDouble:6.626];
as well . . .
Tania Dsouza
5,208 PointsTania Dsouza
5,208 Pointswhy isnt any of these working