Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Objective-C Basics (Retired) Functional Programming in C Functions

Functions challenge

Ok, why is this not working...?

float addTwo(float a, float b) { return a + b; }

8 Answers

Florian Neveu
Florian Neveu
2,383 Points

I'm in the same case... I don't understand ):

Samantha Tyson
Samantha Tyson
384 Points

Is there a way to skip the challenge? I just want to go to the next section.

Holger Liesegang
Holger Liesegang
50,595 Points

Amit Bijlani

I just tested this:

float addTwo(float a, float b)  {
    return a + b;
}

(and a few IMHO other correct versions) in https://teamtreehouse.com/library/functions Challenge task 1 of 1 of


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)


and it gives the error message: "Bummer! Make sure you've defined the return type and both paramter types as 'float' and that you are returning the sum of the arguments as a result."

Maybe there's something wrong with this challenge at the moment...

Kind Regards Holger

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

This challenge was broken due to some recent changes but it should work now. Sorry for the inconvenience.

There must be something wrong with that section... hmm

Florian Neveu
Florian Neveu
2,383 Points

Of course, return on the track (http://teamtreehouse.com/tracks/ios-development) and select the next step !

Samantha Tyson
Samantha Tyson
384 Points

Thanks. Of course that makes sense.

Henry Moran
Henry Moran
10,516 Points

So is this right? I'm stuck with this challenge for the moment...

float addTwo(float a, float b){
    return a + b;
}