On Wednesday, 1 March 2023 at 19:05:10 UTC, DLearner wrote:
(1) & (2) compile and run with the expected results. But (3) fails with: ```Error: variable `wk_Idx` is shadowing variable `for3.main.wk_Idx```` Why is this usage wrong?
With `foreach`, you can't reuse an existing variable as the loop variable. It always declares a new one. If you want to reuse an existing variable for your loop, you have to use `for`.