Advanced Patterns
Here are some additional pattern forms that are useful:
p1 | ... | pn: an "or" pattern; matching against it succeeds if a match succeeds against any of the individual patternspi, which are tried in order from left to right. All the patterns must bind the same variables.(p : t): a pattern with an explicit type annotation.c: here,cmeans any constant, such as integer literals, string literals, and booleans.'ch1'..'ch2': here,chmeans a character literal. For example,'A'..'Z'matches any uppercase letter.p when e: matchespbut only ifeevaluates totrue.
You can read about all the pattern forms in the manual.