You can read the manual section on "scope . "
Variables act as functions: in
function foo(x) return bar(x)^2 end
you do not need to pass bar as an argument, define it internally, or declare it a global function. If you wanted to, you could define an inner bar function that locally overrides the global bar function. Variables act similarly: the only time you must explicitly use global is if you change the global variable inside the function.
tholy source share