Stellar Language Quick Reference
Also available as:
PDF

Stellar Language Match Expression

Stellar provides the capability to write match expressions, which are similar to switch statements commonly found in C-like languages.

match{ logical_expression1 => evaluation expression1, logical_expression2 => evaluation_expression2, default => default_expression} 

Where:

  • logical_expression is a Stellar expression that evaluates to true or false. For instance var > 0 or var > 0 AND var2 == 'foo' or IF ... THEN ... ELSE

  • evaluation_expression is a Stellar Expression

  • default is a required default return value, should no logical expression match

    • default is required

    • Lambda expressions are supported, but they must be no argument lambdas such as () -> STATEMENT

  • Only the first clause that evaluates to true will be executed.