Skip to content

LangSpecs Misc CommaSepList

Neuron Teckid edited this page Mar 9, 2017 · 1 revision

Comma Separated Expression List

A list of expressions or identifiers with comma as the separator is widely used in a lot of languages, and Flatscript provides flexible syntax to write it.

In Flatscript, a comma separated list allows an extra comma at the end, which helps when append new items at the end of the list by copy-and-paste.

For example

leapYears: [1896, 1904, 1908]
primeNumbers: [
    2,
    3,
    5,
    7,
    11,
]

They are both correct.

Flatscript allows line break after any comma in comma separated list.

For example

enum WHITE, BLACK,
     RED, YELLOW, BLUE

is equivalent to

enum WHITE, BLACK, RED, YELLOW, BLUE
Clone this wiki locally