haxe Pattern matching

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

Pattern matching is the process of branching depending on provided patterns. All pattern matching is done within a switch expression, and individual case expressions represent the patterns.

The fundamental rules of pattern matching are:

  • patterns will always be matched from top to bottom;
  • the topmost pattern that matches the input value has its expression executed;
  • a _ pattern matches anything, so case _: is equal to default:.

When all possible cases are handled, the catch-all _ pattern or default case is not required.



Got any haxe Question?