Is it okay that, in Julia, code that never executes can change the result of programs?

@frankwswang, when confused with scope, I always ask myself this: Where was the variable declared?

In your first example, there are two x’s. One is implicitly declared in the function argument, another is explicitly declared with local x inside the let block.

In your second example, there’s only one x-- the one implicitly declared in the function argument.

And you’re right, it doesn’t matter if the declaration comes after the assignment, as in your first example.