3 ms·
I find it odd that no language seems to have a syntax short-cut (like operators) for something as common as switches; the closest thing might be a shell script!
by makecheck 7y ago
I find it odd that no language seems to have a syntax short-cut (like operators) for something as common as switches; the closest thing might be a shell script!
This is a very common thing to write. Why couldn’t a switch avoid all keywords and look more like a list...such as:
?(value):
- 0: { doThing(); }
- 1: { otherThing(); }
- *: { doDefault(); }
- rbonvall 7y agoHaskell's syntax is pretty minimal: f 0 = doThing f 1 = otherThing f _ = doDefault