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) Fundamentals of C Variables

Stuck in a code challenge

this is the task number 1. " Create a float variable name radius whit the value of 14.5..." i wrote the obvius: float radius = 14.5; But when i press "check work" nothing happens. Someone knows what i am doing wrong?

3 Answers

Stone Preston
Stone Preston
42,016 Points

your code is correct. Try refreshing the page and trying again

Steven Chin
Steven Chin
2,001 Points

I think with Objective-C, you may have to append a type to the number. For example:

float radius = 14.5f; where 'f' tells the compiler the type that will be held.

I believe you can also cast the number as well: float radius = (float)14.5;

I am not too sure about this so try it out and see what happens.

Stone Preston
Stone Preston
42,016 Points

while you are correct, you dont usually have to do this (unless you really want float precision). the float is just interpreted as a double if you omit the f. It makes no difference in this challenge though.

Treehouse support give the answer! I was using google chrome so i try with a incognito mode and works. Thank you!