Multi Line Arm
The arm of a match
expression can contain multiple lines of code by wrapping the right side of the arrow =>
in brackets {}
.
let number = 5;
let result = match number {
0 => {
// Multiple lines of code here then return 10
10
},
1 => 20,
5 => 50,
catch_all => 0,
};