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 trialGabriel Monteiro
257 Pointsdid not understood
where am i wrong
int addTwo (float 1, float 2) { return 1 + 2; }
2 Answers
stoyantodorov
7,666 PointsI'm pretty sure variable/param names can't start with a number. And in the return statement you are returning 1+2, which will always return 3.
Make it
int addTwo (float first, float second) { return first + second; }
I'm not sure if that's the exact syntax, because I have not worked with obj C, but u get the idea.
And why are your params 'float', when the function is 'int'?
Ben Hopkins
Full Stack JavaScript Techdegree Student 2,348 PointsYou're correct, and it also should return a float, so: (your syntax was fine):
float addTwo (float first, float second) {
return first + second;
}
stoyantodorov
7,666 PointsYep. Either make the params int, or the function float.