18 lines
393 B
Text
18 lines
393 B
Text
REBOL [
|
|
Title: "Generic Swap"
|
|
URL: http://rosettacode.org/wiki/Generic_swap
|
|
Reference: [http://reboltutorial.com/blog/rebol-words/]
|
|
]
|
|
|
|
swap: func [
|
|
"Swap contents of variables."
|
|
a [word!] b [word!] /local x
|
|
][
|
|
x: get a
|
|
set a get b
|
|
set b x
|
|
]
|
|
|
|
answer: 42 ship: "Heart of Gold"
|
|
swap 'answer 'ship ; Note quoted variables.
|
|
print rejoin ["The answer is " answer ", the ship is " ship "."]
|