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

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

Asked by 5 years ago

i have seen this in alot of scripting videos what doesit mean?

0
it is used to show a list. https://www.grammarbook.com/punctuation/commas.asp Rule 1 User#5423 17 — 5y
0
Oh the humor. User#21908 42 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

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.

5
you can also use a comma in a for loop, just adding on to this list SheepishCovers 28 — 5y
Ad

Answer this question