In an each loop, the scoping of variables is not really handled. If a variable is declared in one iteration of the loop, it's value is kept in the following iterations
In the following example, the variable newVariable will be set to test from the beginning until the end of the loop iteration
- var array = [1,2,3,4]
each value, index in array
if index === 0
- var newVariable = 'test'
Is this a known issue?
In an
eachloop, the scoping of variables is not really handled. If a variable is declared in one iteration of the loop, it's value is kept in the following iterationsIn the following example, the variable
newVariablewill be set totestfrom the beginning until the end of the loop iterationIs this a known issue?