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 trialtiago goncalves
1,912 Pointshelp here please lol
Implement a function named "addTwo" that returns the sum of two floats. The function will accept two float numbers as arguments and return a float which is the sum of the two arguments passed to the function. (No need to write the main function just write out the implmentation for the addTwo function)
whattttttttt lol not even with the video....
tiago goncalves
1,912 PointsI will do that. Thank you. Of course this is not easy but isn't impossible. Thank you for your advice
3 Answers
Stone Preston
42,016 Pointsthe function should look something like this:
returnType functionName(datatype argumentOne, dataType argumentTwo) {
return something;
}
the name of the function needs to be addTwo. the return type needs to be a float, as do your two parameters. you need to return the sum of the two parameters in the function body.
tiago goncalves
1,912 Pointsdidnt work the way you did it but im going to work on that..
let me ask you some have been doing wall the apps and the things in ios track??? everything?
Stone Preston
42,016 Pointsive done all the ios stuff except the photo browser app which came out last week. i plan on doing that one soon. Also could you post the code you tried using my outline? note that the code i provided is just a guideline of how to do the challenge, its not the actual answer
tiago goncalves
1,912 Pointsthats good. im still studying computer science engineer. and still learning..
what you do for living. with your knowledge you must do something good...
Bijan Boustani
8,192 PointsaddTwo(floatOne, floatTwo) { var sum = floatOne + floatTwo; return sum; }
Stone Preston
42,016 Pointsremember that this is c, not javascript, so you would need datatypes on your function parameters as well as your sum variable. You are also missing the return type of the function, but the logic of the function is correct
tiago goncalves
1,912 Pointslol in the movie the professor didn't teach that lol
but thank you. im gonna see if it works
Stone Preston
42,016 PointsStone Preston
42,016 Pointsmost of the challenges contain material that isnt covered directly in the videos. They contain concepts covered in the videos, but you will have to think out the answer on your own using knowledge gained from watching. some of them can be pretty challenging (this one for example). If you have trouble understanding the concept of the challenge I find it best to go back and watch the first video or 2 that occur before the challenge