`include`, like `eval` operates in the global module scope, not the function
On Sun Feb 08 2015 at 8:50:25 PM Chang Kwon <[email protected]> wrote: > In "foo.jl" > > function foo(value) > > x = value > > include("bar.jl") > > > println(bar(10)) > > end > > > > In "bar.jl" > > function bar(y) > return x + y > end > > > When I run the following code, I receive an "x not defined" error. > > > julia> include("foo.jl") > julia> foo(10) > > > What is wrong here? If I define function bar(y) inside the foo(value) > function, instead of including bar.jl, it works fine. > > > >
