Files
ValueScript/inputs/passing/copyCounting/arraySwap.ts
2023-06-22 18:03:16 +10:00

20 lines
336 B
TypeScript

//! test_output(0)
/// <reference path="../../../concept-code/vs.d.ts" />
export default function main() {
return measure(true) - measure(false);
}
function measure(swap: boolean) {
const x = Debug.makeCopyCounter("x");
let arr = [x, "y", "z"];
if (swap) {
[arr[1], arr[2]] = [arr[2], arr[1]];
}
return x.count;
}