Creates a switch statement
Aliases:
switch (variable) { case value1: // Your code here break; case value2: // Your code here break; default: // Your code here}
switch variable { case value1: // Your code here break case value2: // Your code here break default: // Your code here}
case variable of pattern1 -> expression1 pattern2 -> expression2 _ -> defaultExpression
case variable {when value1 # Your code herewhen value2 # Your code hereelse # Your code here}
switch variable) { case value1: // Your code here break; case value2: // Your code here break; default: // Your code here}
switch (variable) { value1 { # Your code here break } value2 { # Your code here break } default { # Your code here }}
case variablewhen value1 # Your code herewhen value2 # Your code hereelse # Your code hereend
match variable { value1 => { // Your code here }, value2 => { // Your code here }, _ => { // Your code here }}
case variable in pattern1) // Your code here ;; pattern2) // Your code here ;; *) // Your code here ;;esac