December 2018
Beginner to intermediate
500 pages
12h 10m
English
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: ...
Read now
Unlock full access