Three ways to write a list with commas
The same items can be written with commas in three common ways, and the layout buttons switch between them:
- One line:
red, green, blue. The usual way to write a list in a sentence, a form field or a search box. Each comma is followed by a space. - Comma at the end of each line:
red,thengreen,thenblueon the next lines. This keeps one item per line, which is how items are listed in code arrays, config files and long lists you want to read and edit. - No spaces:
red,green,blue. Used for URLs, command line options and some import fields that do not allow spaces.
The comma after the last item
In the line by line layout, the last item has no comma by default, because that is what most lists want. Some languages, including JavaScript, Python and Rust, allow a comma after the final item in a list, which makes lines easier to add and move around. JSON does not allow it, and neither do most import forms, so leave it off unless you know the place you are pasting into accepts it.
Under More options, the Separator after the last item switch adds it back.
Numbers, words and quotes
For a list of numbers, such as 3 and 14 and 159, leave quotes off: 3, 14, 159. For a list of words or names that is going into code, a database query or a spreadsheet formula, add quotes: 'red', 'green', 'blue' for SQL, or "red", "green", "blue" for most programming languages. The SQL IN list style does this and adds the brackets as well.
If an item contains the quote character itself, such as O'Brien inside single quotes, it is escaped when you add quotes. By default a backslash is put in front of it. You can choose to double it instead, which is what SQL and CSV use.