Generic swap: Difference between revisions

added alternative implementation - for Arturo
(Added Arturo implementation)
(added alternative implementation - for Arturo)
Line 335:
=={{header|Arturo}}==
{{trans|Ruby}}
===Using multi-assignment===
<lang rebol>swap: function [a,b]-> @[b,a]
 
c: 1
d: 2
print [c d]
 
[c,d]: swap c d
print [c d]</lang>
 
{{out}}
 
<pre>1 2
2 1</pre>
 
===In-place modification===
 
<lang rebol>swap: function [a,b]-> @[b,a]
 
1,532

edits