Key points:
function <name>(<arguments> ; <keyword args>)
#
# function body
#
return <var> #this is OPTIONAL, returns last in by default
end
<function name>(<args>, <keyword>=<arg>)
<func_name>(<arguments>) = <function body>
Example:
c(r) = 2*pi*r
map(<var> -> <function_body>, <vector to be calculated>)
Example:
map(x -> 2 * pi * r, [1,3,5])
Make a filter on the input by explicitly declaring the type.
function circumference(r::Float64)
function U(m::real, h=100)
function U(m,h,;g)
#calling it as:
U(1,1,g=1)
The ...
is a variable argument, i.e, it can accept any number of parameters.
function sum(x, y...)