switch, there is an implicit requirement that the switched object must have a method for comparing 'equality'. Integers and strings inherently support operator == (either implicitly or explicitly). Therefore, for a custom object, the developer must implement an operator == to make it usable in a switch statement (this is mandatory).match may be more modern, years of muscle memory keep me using switch by default.Moreover£¬most other languages use switch for string comparisons too.