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
Zach Burt
188 PointsI need help with iOS scopes.
The question asks me to "Implement a function named "addTwo" that returns the sum of two floats. The function will accept two float numbers as arguments. It should add the two arguments together, and return the result. (No need to write the main function. Just write out the implementation for the addTwo function.)" but I am confused on how i should write this, I started out by creating the function, but I don't know what else to do, please help :).
2 Answers
Andrew Gray
10,088 Pointsfloat addTwo (float a, float b) { return a + b; }
Here we have given the function the name addTwo, given it two floats as arguments in (), then told it to return the sum of them in the {}.
Zach Burt
188 PointsThanks :), I thought that I had to write out the function, and then return the float values inside of it.