Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: modernize for 0.52.2

...

Code Block
languagejavascript
themeConfluence
<pred0> => <expr0> |
<pred1> => <expr1> |
<pred2> => <expr2> |
...
           <exprn>

Because of the limitations of the parser, most predicates will need to be enclosed in parenthesesHere are a couple of examples, whose predicates are enclosed in parentheses (this is not required, but can be clearer when reading code):

Code Block
languagejavascript
themeConfluence
z = (x > y) => y | x


d = (x > y) => x - y
  | (x < y) => y - x
  |            0

Note three different styles: all on a single line, or on multiple lines, one per expression, either ending with the vertical bar or with the expression, but in either case the expressions are lined up, and the vertical bars are lined up. These styles are not required by the language syntax but are recommended for readability of your code.