Difference between revisions of "Line continuation"

From MiniScript Wiki
Jump to navigation Jump to search
(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...")
(No difference)

Revision as of 13:26, 30 April 2021

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.