Match Blocks

The match block is used to pattern match literals against multiple patterns. The first pattern that matches the literal is executed. In this example, we match the xenia tuple against two patterns. The first pattern matches the age 42 and the second pattern matches any other age.

xenia = ("Xenia", 42) match xenia { (name, 42) -> name + " is 42", (name, _) -> name + " is not 42" }

© 2024 ouzu