Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

what does the comma (,) mean in scripting? I don’t understand what it means can someone explain?

1 answer

✓ Accepted answer

A comma is used in a few ways, mainly to separate items in a list or variable names/values. Here is one example:

local list = {"hello", "bye", "bog", "wasteland"} -- here I used a comma to separate the items in the list

Here is an example where I separate variable names:

local money, survived = 50, false -- here I set the value of money to 50 and survived to false by separating with commas

The last use I can think of currently is the separation of parameters and arguments. Here is an example:

local function printAddition(a, b) -- here I define a function and because there is more than one parameter I am putting in I separate them with a comma
	print(a+b)
end
printAddition(1, 2) -- here I am inputting two values. One for a and one for b so I separate them with a comma
-- Output would be 3

I hope this simple explanation helps and have a great day scripting! Note: I just woke up so please excuse any minor errors you might find.

1 comment

5

you can also use a comma in a for loop, just adding on to this list

This discussion is preserved as it was. New answers, comments, and votes are closed.