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

Radius Float variable?

In the first challenge it asks to create a float variable radius with the amount 14.5.

This is what I've submitted:

{ float radius = 14.5;

}

I'm pretty sure this is how you declare a float variable, but It's telling me to recheck my work. What am I doing wrong?

5 Answers

You don't actually need the curly braces when creating a variable.

Curly braces are used to denote a code block and you'll use them when you write functions, loops, conditionals, etc...

I'm having problem with this course as well. I keep thinking it's missing a video.

Hmmm. So I tried it again and it submitted this time. Not sure what I could have done differently but for anyone else having this problem - make sure you're writing on the first line. This is what I submitted as my code -

float radius = 14.5;

Good luck!

I'm confused now. Did you submit it the first time with the curly braces or without?

Jason Anello - Without the curly brackets the first time, hence my confusion as to why it wasn't running. I added the brackets in there for the post thinking that's what I was missing.

That's strange then because I don't see a difference between the two variable declarations.

I'm not sure if you're saying you put in the curly braces to post it as code but you need to use 3 backticks if you wanted to post it as code.