Julia:passing argument to the `include("file.jl")`

Viewed 2491

I was wondering if it is possible to pass arguments to include("file.jl"). For example we parse the ARGS in the file.jl and use them in there. Similar to what we do in a command line by passing arguments.

2 Answers

To include code have the same effect than to copy that peace of code into the 'includer' code. If the included code run differently depending of several 'parameters' then that is probably a strong indication that you must encapsulate that code using functions or modules. Also, in julia, 'raw' code tend to be faster inside functions Performance Tips

Related