Writing your own julia functions

  • functions can be defined in .jl files, command line, or notebooks
  • scoping is as expected

Verbose:

  • start with function keyword followed by function name and input args
  • end is a keyword that tells the function to return most recent statement result if no return
function myfun(x)
    s = sin(x)
    return exp(s)
end

Compact:

myfun(x) = exp(sin(x))

Anonymous/lambda function

plot( x->exp(sin(x)), 0, 6 )