Wu Language
Search…
Switch
Switch expressions work basically like ifand can be used like the following:
1
a := compute_some_number()
2
3
switch a {
4
| 0 => print("a is zero")
5
| 10 => print("a is ten")
6
| _ => print("something else")
7
}
Copied!
And can be used as expressions:
1
foo: str = switch 10 {
2
| 10 => "foo"
3
}
Copied!
Very nice.
Last modified 2yr ago
Copy link