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
Jose Macias
1,545 PointsFunctions code Challenge
well i need more help on functions, i've seen the video many times but i can never get the challenge right!! Help!!
Jose Macias
1,545 Pointshttp://teamtreehouse.com/library/functions
Code: float addTwo = (float 1, float 2); return 1 + 2;
amit reddy
469 Pointsok so you need to create a function but your code looks like you are declaring something.
""" float addTwo(param1 param2){
code; }
4 Answers
amit reddy
469 Pointsyou are not supposed to declare something you have to create a function. i think you should watch video of how to create a function once again. Don't over think its simple just do what they say.
good luck.
Jose Macias
1,545 Pointsstill not sure
amit reddy
469 Pointsok so try doing this
float addTwo(float a, float b){
return a + b;
}
1) float is a type of function 2) addTwo is a function name 3)float a, float b are parameters in your case you have declared numbers which is not right. 4) inside the curly braces we are returning the sum of two floats.
hope you got it
Jose Macias
1,545 Pointsi had already got it before u gave it to me but thanks anyway
amit reddy
469 Pointsgood job
Jose Macias
1,545 Pointsthanks
Mohammad Ghahramani
Courses Plus Student 5,524 PointsHi i found this really helpful i was stuck on it but was making it more complicated than it should've been.
roddutra
2,703 PointsI was stuck on the same challenge, thank you amitreddy!
Luke Fremer
207 PointsThanks amit reddy, was stuck on this, and was looking for solutions through previous lessons and my Xcode files.
Stone Preston
42,016 PointsStone Preston
42,016 Pointslink the actual challenge and post the code you are using.