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 trialnemanjasreckovic
8,784 PointsObjective-C Basics, Challenge task - Write a function named "addTwo"
"Write a function named "addTwo" that accepts two float numbers as arguments. The function should also return a float which is the sum of the two arguments passed to the function."
I wrote
int addTwo(float a, float b) {
return a + b;
}
Amit Bijlani what did I do wrong ? thx!
2 Answers
Holger Liesegang
50,595 PointsHi Nemanja, I'm not Amit, but "The function should return a FLOAT" and you returned an INTEGER - the rest is ok :-)
Josue Abreu
Courses Plus Student 266 Pointswow i could not figure this out lol
nemanjasreckovic
8,784 Pointsnemanjasreckovic
8,784 Pointswow, I was under impression that I always declare function using int name_of_fun, ... thanks!
agreatdaytocode
24,757 Pointsagreatdaytocode
24,757 PointsI fell for that too. It was driving me nuts lol.
Alexander Bakushkin
5,120 PointsAlexander Bakushkin
5,120 PointsThank you for your answer. In learning path teacher didn't tell about it...I think:))