January 2020
Intermediate to advanced
532 pages
13h 31m
English
It is best when we can just use global constants. But what if the variable does need to be changed during the life cycle of the application? For example, maybe it is a global counter that keeps track of the number of visitors on a website.
At first, we may be tempted to do the following, but we quickly realized that Julia does not support annotating global variables with type information:

Instead, what we can do is to annotate the variable type within the function itself, as follows:
function add_using_global_variable_typed(x) return x + variable::Intend
Let's see how it performs:
That's quite a ...
Read now
Unlock full access