Ah, I see. I thought you are running your code in the REPL as you said in the OP.
FYI the REPL is the interactive command line which waits for your input when you start julia without a .jl file.
You can solve your issue the easiest by putting
let
...
end
around everything.