haxe Pattern matching Structure matching


Example

Assume the following structure:

var dog = {
    name : "Woofer",
    age : 7
};

Enum matching can be performed as follows:

var message = switch(dog) {
    case { name : "Woofer" }:
        "I know you, Woofer!";
    case _:
        "I don't know you, sorry!";
}

References