或模式

|運算子可以在模式中的任何位置使用,以描述多個可接受的模式。如果 or-pattern 中存在捕獲的變數,則它必須出現在其子模式中。

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

參考