Generic swap: Difference between revisions
added alternative implementation - for Arturo
Drkameleon (talk | contribs) (Added Arturo implementation) |
Drkameleon (talk | contribs) (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]
|