I think the idiomatic style is as follows:
- A mutable
A
is modified by a function asf!(A)
. - An immutable
x
is modified by a function usually asx = f(x)
.
Example:
function f!(A)
A .= 1:length(A)
end
A = zeros(4)
f!(A)
@show A;
A = [1.0, 2.0, 3.0, 4.0]
f(x) = x + 1
x = 99
x = f(x)
@show x;
x = 100