Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!