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 instancevar > 0
orvar > 0
ANDvar2 == 'foo'
orIF ... 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.