We haven’t covered variable scope yet. The rules are … complicated … but rarely affect Exercism exercises in practice.
The best guide to using global variables is: don’t (though global constants are good).
In many languages, mutating global variables leads to confusing code, and in parallel execution it leads to race conditions. Julia has the extra problem that global variables confuse the JIT compiler and make your program run much slower.
Self-contained functions (taking arguments, returning results, without side effects) are usually the better solution.