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

Andres Elizondo
Andres Elizondo
1,996 Points

what does it means an expected expression in this case?

I was taking this challenge and then I got this error and I have no idea what does it mean.

3 Answers

Tommy Choe
Tommy Choe
38,156 Points

Hey Andres, you're probably missing a semicolon or a closing parentheses somewhere in your expression. Make sure you double check what you wrote.

Let me know if you're still having problems.

Andres Elizondo
Andres Elizondo
1,996 Points

Can you check the challenge? I made something like this but I still get an error, I only have to do the implementation part. Thanks for your help!

float addTwo (float a, float b){
  float result = 0; 
  result = a + b; 
  return = result;
}
Tommy Choe
Tommy Choe
38,156 Points

Ok so I see the problem. You put an equals sign between return and result. That's why the compiler kept complaining that something was wrong.

Return is a special keyword that lets the compiler know that anything that follows it will be returned by the function. In order to return the result you would just take out the equals operator. You don't want to assign anything to return.

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

That's it! Let me know if that all made sense to you.

Andres Elizondo
Andres Elizondo
1,996 Points

ohh I see, hahaha I spend like 4 hours looking for similar codes to see what was wrong and I didn't notice that! Now I know it.

Thanks a lot!

Tommy Choe
Tommy Choe
38,156 Points

No problem Andres. Glad I could help! I'm gonna mark as best answer so we can close this post off