企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
数组可以使用固定的长度匹配: > 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.