Inconsistent julia behaviour

When I run the following in either a file or julia repl within Atom I get the error that s is undefined:

s = 0
for i = 1:10
     s += i
end

But when I run in external julia terminal it works fine. I am using Atom v 1.51.0 and julia v 1.5.1