julia> type RR
x::Int
end
julia> function tt(x,y)
if (x+=y) > 0
x
else
y
end
end
tt (generic function with 1 method)
julia> import Base:+,>,<
julia> +(a::RR,b::RR) = RR(a.x+b.x)
+ (generic function with 181 methods)
julia> >(a::RR,b::Int) = a.x > b
> (generic function with 3 methods)
julia> <(a::Int,b::RR) = a<b.x
< (generic function with 60 methods)
julia> x = RR(3)
RR(3)
julia> y = RR(5)
RR(5)
julia> tt(x,y)
RR(8)
julia> x
RR(3)
even though the returning result is RR(8) but the passed argument x is not changed? Why is that?
Thanks