On Sun, Apr 3, 2016 at 9:16 AM, Gino Serpa <[email protected]> wrote:
> Hi,
> I know that I can pass arguments to a script using ARGS and then just
> running from the console  prompt  as in
>
>> julia test01.jl 2048
>
> where the argument 2048 is passed to test01.jl. But what if I want to pass
> this argument inside julia to the same script

In general, you should arrange your code so that you can run the code
in the script by calling a function. We don't have particularly good
support for using a file both as a script and as a code to include yet
but you can still split out the actual code and the command line
interface into two files and only include the first one.

>
> julia > include("test01.jl")   , where do I include the 2048 argument?

You can modify the ARGS array like any other imported global variable.

>
> Now I could do it form inside  julia but then I have no access to the
> variables.
>
> Sorry if this has been asked before but a search in google yielded no
> answers
>
> Cheers
> Gino

Reply via email to