You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the introduction of variables with assignments, our scopes can be specified "inside out" --- whether something is a scope can depend on what is inside. This can prevent a block from being at the top level, thereby forbidding top-level-only expressions.
The if statement doesn't really (adding x=1 above the for loop will indeed assign x globally). It's just that the compiler is being lazy and lumping the whole expression into one "non-top-level-thing" even though only the for loop part of it actually creates a scope.
Given
I get
error compiling anonymous: unsupported or misplaced expression using in function anonymous
forbut on the other hand the following works fine:
I'm don't understand why
using
would be allowed in oneif
statement but not in the other.The text was updated successfully, but these errors were encountered: