F#Pattern Matching


Pattern Matching is a powerful feature of many functional languages as it often allows branching to be handled very succinctly compared to using multiple if/else if/else style statements. However given enough options and "when" guards, Pattern Matching can also become verbose and difficult to understand at a glance.

When this happens F#'s Active Patterns can be a great way to give meaningful names to the matching logic, which simplifies the code and also enables reuse.