New scope solution

Both let and for currently introduce a scope, so I don’t see what the relevant difference from IEFE is. Unlike for, let has the advantage that it evaluates to its last statement, so it may be used to get function-level scoping, e.g., this works:

let
    x = 0
    for i in 1:10
        x += i
    end
    x
end

No need to define a function.

4 Likes