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
Vijay Ramdass
13,275 PointsCode Challenge: Functions not working
Hello, I looked at other questions to see where my mistakes were. I cleaned up my original code, however I am still getting errors. Can someone show me what I am doing wrong?
Edit:
I tried posting a screenshot, I am not sure how to. Below I posted my code:
float addtwo (float a, float b){
return a + b;
}
7 Answers
Vijay Ramdass
13,275 PointsHey Kieran, this worked for me:
float addTwo (float a, float b) { return a + b; }
Make sure the name of the function is spelled, and capitalized exactly how they ask.
Vijay Ramdass
13,275 PointsUPDATE:
I figured out what my problem was. The function has to be named addTwo instead of addtwo. I guess I got a lot of practice figuring it out lol.
Kieran Tross
8,266 Pointsanyone know the answer to this one. I had something similar to the other post. Still doesn't work.
Kieran Tross
8,266 PointsHere is what I have
float addTwo (float a, float b) return a+b;
doesn't work
Vijay Ramdass
13,275 PointsHey Kieran, you have to put the {return a + b; } in the squiggle brackets. Sorry for lack of term for the brackets.
Kieran Tross
8,266 PointsNo i figured it out. Thanks man!
Vijay Ramdass
13,275 PointsWhat was the problem?