function squared(x)
.^ 2
x end
squared (generic function with 1 method)
Define new functions with function
:
function squared(x)
.^ 2
x end
squared (generic function with 1 method)
squared(3)
9
Optionally define types using ::Type
:
function squared(x::Float64)
.^2
x end
squared (generic function with 2 methods)
squared(3)
9