switch used as an expression
Here’s the code if you want to experiment with it:
let spelledOut = switch Int.random(in: 0...3) {
case 0:
"Zero"
case 1:
"One"
case 2:
"Two"
case 3:
"Three"
default:
"Out of range"
}