|
|
|
|
|
by timmytokyo
3629 days ago
|
|
Another advantage of pattern matching is extensibility. Suppose you wish to add a new branch case. Under the traditional if/else (or switch) model, you'd need to modify the function containing the if statements. With pattern matching, you simply introduce a new function; it decentralizes the change and acts as a sort of simple, intuitive polymorphism. |
|