Adept
Adept copied to clipboard
Feature request: switch expression
For example, if I could write this code:
rateText String
switch rate {
case 1 rateText = "Weak"
case 2 rateText = "Moderate"
case 3 rateText = "Strong"
case 4 rateText = "Powerful"
default rateText = "Unknown"
}
Into this:
rateText String = switch rate {
case 1 "Weak"
case 2 "Moderate"
case 3 "Strong"
case 4 "Powerful"
default "Unknown"
}
It would make the code shorter to type as rateText
is only typed once. Its also much nicer to look at.
Currently, typing this switch expression makes the compiler error "unexpected switch token in expression".