Also, the following section of the manual may be helpful:

http://docs.julialang.org/en/release-0.4/manual/noteworthy-differences/

On Wed, Mar 23, 2016 at 10:45 AM, Isaiah Norton <[email protected]>
wrote:

> - include should be used outside the function.
> - 'c' is not defined anywhere in your code.
>
> ```
> f1 inorton$ cat foo.jl
> c = 100
> f1 inorton$ cat bar.jl
> include("foo.jl")
>
> println("c = ", c)
> f1 inorton$ julia bar.jl
> c = 100
> ```
>
>
> On Tue, Mar 22, 2016 at 8:02 PM, new to Julia <[email protected]>
> wrote:
>
>> Hi all:
>>
>> I have two function files saved in two different jl file. I can call
>> files. However, for variables defined in one file, I cannot use it in the
>> other file. The following is a simple example:
>>
>> function test(x)
>>   y1=6*x;
>>   y2=x/5;
>>   y1,y2
>> end
>> pwd()
>>
>>
>>
>> ## test and test2 are used for calling functions in Julia
>> function test2(x)
>>   include("test.jl")
>>   yold,ynew=test(x/c);
>>   y3=yold+10;
>>   y4=ynew-10;
>>   yold2,ynew2=test(x)
>>   y5=yold2+20;
>>   y6=ynew2-20;
>>   y3,y4,y5,y6
>> end
>> y3,y4,y5,y6=test2(100)
>>
>> when I run test2, it always comes an error: c is not defined.
>>
>> I am wondering that how to do with this? Thank you!
>>
>
>

Reply via email to