B
Brad
Hello all,
I have a problem that may or may not be an easy fix.
Given the following:
a=1
b=2
def swapper(dest,src)
dest,src=src,dest
end
swapper(a,b)
p [ a, b ]
Why are the values of the variables not swapped? Is there
a way to coerce ruby into doing a and b by using src and dest?
Any help is greatly appreciated.
Thanks,
Brad
I have a problem that may or may not be an easy fix.
Given the following:
a=1
b=2
def swapper(dest,src)
dest,src=src,dest
end
swapper(a,b)
p [ a, b ]
Why are the values of the variables not swapped? Is there
a way to coerce ruby into doing a and b by using src and dest?
Any help is greatly appreciated.
Thanks,
Brad