Hacker News new | ask | show | jobs
by setr 2731 days ago
Well for one, the cases of a match statement are guaranteed to use the same variables and return the same output, in every case — the equivalent if-elseif-else does not offer the same guarantees, and has to be read in full to reach the same conclusion

So the statements are equivalent in whole, but the difference is that a match statement requires less reading (as it holds more meaning)