Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

can someone explain to me and give an example of an argument being used?

Asked by 10 years ago

i already looked it up on roblox wiki, but i was wondering if you could give me an example and a more simple definition of it

1 answer

Log in to vote
2
Answered by 10 years ago

An argument, also known as a parameter, is used in functions when you want to use a variable in a function, usually because you don't know exactly what you want to do or you don't know what you are performing the action. For example, say I had a function to change the BrickColor of a part:

function changeBrickColor(part, newColor)
    part.BrickColor = newColor
end

'part' and 'newColor' are the arguments, because they tell us which part to change the BrickColor of, and what to change it to. We would then call the function like so:

changeBrickColor(Workspace.Part, BrickColor.new('Really red'))

Which would change the BrickColor of Workspace.Part to 'Really red'.

0
thank you, I think i understand it a little bit more namelessassasin 30 — 10y
Ad

Answer this question