合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
数组可以使用固定的长度匹配: > Arrays can be matched on fixed length: ~~~ var myArray = [1, 6]; var match = switch(myArray) { case [2, _]: "0"; case [_, 6]: "1"; case []: "2"; case [_, _, _]: "3"; case _: "4"; } trace(match); // 1 ~~~ 这会输出1,因为 array[1]匹配6,array[0]允许是任何内容。 > This will trace 1 because array[1] matches 6, and array[0] is allowed to be anything.