How to make a swap function ??
Posted: Fri Oct 07, 2016 6:19 am
I tried to make a swap function, but
it only works if the variables to swap
stay the same...
Is there a way to make a "general" swap
function (without prior knowing which
variables to swap)?
x = 1
y = 2
swap(x,y)
DEF swap(a,b)
temp = a
.x = b
.y = temp
END DEF
it only works if the variables to swap
stay the same...
Is there a way to make a "general" swap
function (without prior knowing which
variables to swap)?
x = 1
y = 2
swap(x,y)
DEF swap(a,b)
temp = a
.x = b
.y = temp
END DEF