Troubleshooting Ruby Codes

Hi All,

I’ve just started Intro to Ruby. I’m now on codewars, However I keep meeting a problem I can’t figure out, nor understand. Even google doesn’t help. It’s very basic (see below), but the Intro to Ruby tutorial doesn’t cover it, so I’m in the dark. Many thanks.

The code does not execute properly. Try to figure out why.
def multiply(a b)
a * b

in what way doesn’t it work properly? Can you also provide the exercise url?


Please find below:

you get an error message:

main.rb:3: syntax error, unexpected tIDENTIFIER, expecting ')'
def multiply(a b)

which should help? For some reason there is a problem with the second parameter, what could it be?

I’ve no idea. I need to pass this one to sign up for code wars.

Surely as a pro you can solve it. It’s very basic. If you cant solve it then theres no hope for me solving it as a complete newby.

codewars are challenges, if you can’t solve this problem (even with the error message), you might want to follow some programming course first.

Could i solve it for you? Sure. But i think you will find codewars very challenging then. I highly recommend teaching site (codecademy, sololearn, udemy) first.

1 Like

Well the reason I started this thread is to get help as I’m starting a bootcamp soon, and I have time constraints. The tutorial I’ve done does not cover this error. I didnt start this thread to get referred to udemy.

Thanks for wasting my time.

Did the tutorial cover functions and parameters? If it does, see if you can find an example and compare that with the code of codewars.

1 Like

@code4522950508 Hello.
Consider checking whether parameters in the function parentheses need commas between each parameter. For example:

def function(a b)

compared with

def function (a, b)

which one is the correct syntax? If you’re not sure, try them both, and see for yourself.
I hope this helps!
Happy coding!

1 Like