或模式

|运算符可以在模式中的任何位置使用,以描述多个可接受的模式。如果 or-pattern 中存在捕获的变量,则它必须出现在其子模式中。

var match = switch(7) {
    case 4 | 1: "0";
    case 6 | 7: "1";
    case _: "2";
}

参考