Line continuation

From MiniScript Wiki
Revision as of 13:26, 30 April 2021 by JoeStrout (talk | contribs) (Created page with "MiniScript statements are separated by line breaks rather than explicit punctuation (such as the semicolon in C). It is nonetheless possible to break a long MiniScript statem...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

MiniScript statements are separated by line breaks rather than explicit punctuation (such as the semicolon in C). It is nonetheless possible to break a long MiniScript statement into multiple lines, by placing the line break immediately after any of:

  • an opening (, [, or {
  • a comma or colon: , or :
  • any binary operator: +, -, and, or, etc.

Example

x = {
     "foo": "A commonly used variable name in example code",
     "bar":
        "A second commonly used example variable name" }

Note that the final } in this example cannot be put on the next line, since it does not follow one of the special line-continuing tokens.