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).
@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"
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 If I make something, for sure I'd go with the spaces mandatory with given size at the language level and no tabs too.
In a language with patterns and matching an "if" is useless since a "case" always is more powerful and subsumes it. So having an "if" is really not needed at all.