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 trialMarco Garduño
1,549 Pointsfloat foodPrice; foodPrice=3.50; what is wrong???
what is wrong in this?
float foodPrice;
foodPrice=3.50;
Chris Shaw
26,676 PointsHi Antonio Montalvo,
The example code you have given is Swift whereas Marco is working with Objective-C.
1 Answer
Chris Shaw
26,676 PointsHi Marco,
I assume you have removed the code for the first task which is required for task 2 to pass, along with that you simply need to assign your float
value as you did in task 1. See the following:
int size = 13;
float foodPrice = 3.50;
You were essentially correct aside from those two things.
Happy coding!
Antonio Montalvo
10,549 PointsSorry Marco, I didn't realize it was Objective-C.
Antonio Montalvo
10,549 PointsAntonio Montalvo
10,549 PointsHi Marco, You should declare first a variable and give it a name. Then you can specify that the variable is of the type Float, and then give it a value. After the variable has been declared then toy can modify it's value. I hope this works for you.
var foodPrice: Float = 3.50; foodPrice = 2.6;