Holy shit, are you reading my mind?
To be honest I was thinking about 4 mandatory spaces (no tab, no different amount of spaces, possibly no more than one way to express a computation).
But I'm also thinking of no `if` only match/switch.
to be fair I can think of cases where sequences of `if/else if` cannot be easily subsumed by a `match/case` statement, not even if you evaluate the case selection expressions (as PHP did, as far as I can remember).
I mean something like
switch(true){
case isMonday(): print "Monday ";
case isSunday(): print "Sunday";
case isJune(): print "June ";
default: print "hi! ";
}
would print "Monday June ", but would not (easily) subsume "if/elif" (as far as I can think right now).
They are mutually exclusive in C (and most other languages, afaik) but I've seen at least one language using:
1) non-constants as case expression
2) non-exclusive branches
A recent example is React's Router dom's Switch (but I've seen this before)
I don't like this approach but I was looking for an `if/elif` idiomatic alternative in an if-less language.
@Shamar I'm not sure I follow, each case must be exclusive, there's no continuing matching on multiple cases after matching on one.
Multiple conditions can easily be done like:
match (isMonday, isJune):
| (true, true) => "monday in june"
| _ => "other days don't care"