Julia provides an option like, a julia
application can accept any number of arguments from command line. This option
facilitates us to configure Application at the time of running. User should pass
command line arguments, at the time of launching application. Command line arguments
passed in the global constant ARGS.
hello.jl
println("Command line arguments are") for i in ARGS println(i) end
$ julia hello.jl Command line arguments are $ $ julia hello.jl hello how are you Command line arguments are hello how are you $ $ julia hello.jl 2 3 5 7 11 13 17 19 Command line arguments are 2 3 5 7 11 13 17 19
‘julia –e’ is used to evaluate an
expression. You can evaluate command line arguments like below.
$ julia -e 'for x in ARGS; println(x); end' 2 3 5 7 11 2 3 5 7 11 $ $ julia -e 'for x in ARGS; println(x); end' hello how are you hello how are you local
No comments:
Post a Comment