0

# can someone explain me about parameters?

so when i was using function then i asked myself what parameters are is it for function like the following code? local function name()

print("function")

end

name()

-- what does that () means in local function name

0

Basically If you were to do "local function name(string)" and you also done "print(sting)" if you were to call it like "name('Hello World!')", So the parameters are basically variables defined when you call the function with arguments.

0

Some functions allow you to put variables in the bracket so you can make them more portable in use. Not all functions need them, however but some do.

Let's look at these two functions:

-- no arguments
local number1 = 2
local number2 = 3
print(number1 + number2)
end



That function was wasteful, why? Because we used two variables which we may never ever need again. However I used add() with empty brackets because it has no parameters.

-- with arguments