langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
20
Task/Generic-swap/REBOL/generic-swap.rebol
Normal file
20
Task/Generic-swap/REBOL/generic-swap.rebol
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
REBOL [
|
||||
Title: "Generic Swap"
|
||||
Author: oofoe
|
||||
Date: 2009-12-06
|
||||
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 "."]
|
||||
Loading…
Add table
Add a link
Reference in a new issue