Don’t use global variables in the function without passing them as arguments.
In my personal opinion, it is also better to avoid using global constants, especially when using Julia for scientific research. Using constants to fix the types inhibits unpredictable composability with various packages.
For example, if you want to see what happens when you perturb the fundamental constant a
, and if you fix the type of a
with const a = ~
, then you will not be able to apply packages such as MonteCarloMeasurements.jl to a
.
Every time you use a constant to fix the type, you are inhibiting yourself from coming up with scientific ideas on how to use Julia.