In cases where for-of loop body has multiple statements, modifications made inside the loop body are not preserved
let out : int = 999;
let _test : (x:unit) => unit = () => {
let x : list<int> = list([1,2,3]);
let y : list<int> = list([]);
for (const i of x) {
let xx = 1;
let xy = 1;
let yy = 2;
y = list([out,...y]);
Test.log(y);
};
Test.log(y);
Test.log("Here");
};
let test = _test();
output
[999]
[999]
[999]
[]
"Here"
Everything at the top-level was executed.
- test exited with value ().
-
has a changelog entry