Files
ValueScript/inputs/passing/copyCounting/arraySwap.ts
Andrew Morris ebf4ca9ae4 Fix bugs
2023-06-29 19:26:42 +10:00

21 lines
352 B
TypeScript

//! test_output(4)
// Should be: 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;
}