Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem of scoping in loops #30

Open
d-p-dev opened this issue Mar 12, 2020 · 1 comment
Open

Problem of scoping in loops #30

d-p-dev opened this issue Mar 12, 2020 · 1 comment

Comments

@d-p-dev
Copy link
Contributor

d-p-dev commented Mar 12, 2020

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?

@bastianccm
Copy link
Contributor

hi @dylan-provost
not exactly known, but probably a limitation.

most variables are scoped "globalish" (in the mixin scope) - much similar to how javascript handles them. (unless you use let/const of course)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants