Equivalent to switch in many other languages.

Docs

See match (docs)

Difference from switch in other languages

Crash-course for people who are familiar with switch statements

  1. Replace switch with match.
  2. Remove case.
  3. Remove any breaks.
  4. Change default to a single underscore.

Syntax

match <test value>:
	<pattern(s)>:
		<block>
	<pattern(s)> when <pattern guard>:
		<block>
	<...>