Lua coding error

Hello, I would like to know what is wrong in my lua code, I am practicing programming

image

You are not even returning, return a * b

2 Likes

Should i do something like this? return (5,9)? or am i wrong? :scream:

No, your function is missing a return

local kata = {}

function kata.multiply(a, b)
    return a * b
end

return kata
1 Like

You should assign your product to a variable.

local kata = {}

function kata.multiply(a, b)
   local product = a * b
   return product
end

return kata

In this case, product is a variable that is storing the value of a * b. This should work better for you.

1 Like

Oh thank you guys so much! :smiley: :smiley:

1 Like

Please do some research before posting questions, this question is extremely basic and could’ve been solved if you googled a little bit.

And when posting your code it’s preferred if you copy-paste it in text with formatting rather than images
```lua
print(“Hello World!”)
```
Will format to

print("Hello World!")