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

Ruby Ruby Basics (Retired) Ruby Methods Method Returns

Working on Ruby Methods section. When I launch the workspace, the code that is in there has an error?

?

def add (a, b) puts a + b end

add (2, 3)

ruby methods.rb - returns error

2 Answers

Do you have a space between add and (2,3)?

If so remove it.

It's the pre-set code from Treehouse that's already in the workspace when I open it up. There is a space there and I tried removing it, but get the same error...

methods.rb:5: syntax error, unexpected ',', expecting ')' add (2, 3)

which video in the methods section? also stupid question: you did make sure you saved it right?

It's the 3rd video "Method Returns" and yes I did save it. I've tried running it with the code it opens up with and modifying the code and I can't get it to work correctly. But the code looks correct....

Hey, thanks for working to help me figure this out. I didn't see there was another space in there they I didn't remove. Once I removed it, it was working correctly. Thanks again!

Not a problem. Remember to mark as answered :)

Always put a komma separator between the values en a space in between, this also leads to greater readability