Before we get to write our first full-fledged Julia program, the web crawler, we need to take yet another important detour. It's the last one, I promise.
As our code becomes more and more complex, we should start using functions. The REPL is great for exploratory programming due to its quick input-output feedback loop, but for any non-trivial piece of software, using functions is the way to go. Functions are an integral part of Julia, promoting readability, code reuse, and performance.
In Julia, a function is an object that takes a tuple of values as an argument and returns a value:
julia> function add(x, y)
x + y
end
add (generic function with 1 method)
There's also a compact assignment form for function declaration:
julia> add(x, y) = x + y
add (generic function with 1 method)
This second form is great for simple one-line functions.
Invoking a function is simply a matter of calling its name and passing it the required arguments:
julia> add...