Rebol3 Code Examplex
The Twelve Days of Christmas
Generate the cumulative verses of the song.
Rebol [
title: "Rosetta code: The Twelve Days of Christmas"
file: %The_Twelve_Days_of_Christmas.r3
url: https://rosettacode.org/wiki/The_Twelve_Days_of_Christmas
]
gifts: [
"A partridge in a pear tree." "Two turtle doves, and"
"Three french hens," "Four calling birds,"
"Five golden rings," "Six geese a-laying,"
"Seven swans a-swimming," "Eight maids a-milking,"
"Nine ladies dancing," "Ten lords a-leaping,"
"Eleven pipers piping," "Twelve drummers drumming,"
]
days: [
first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth
]
for day 1 12 1 [
print ["^/On the" as-green days/:day "day of Christmas"]
print "My true love gave to me:^/"
for gift day 1 -1 [ print [tab gifts/:gift] ]
]Output:
On the first day of Christmas
My true love gave to me:
A partridge in a pear tree.
On the second day of Christmas
My true love gave to me:
Two turtle doves, and
A partridge in a pear tree.
On the third day of Christmas
My true love gave to me:
Three french hens,
Two turtle doves, and
A partridge in a pear tree.
On the fourth day of Christmas
My true love gave to me:
Four calling birds,
Three french hens,
Two turtle doves, and
A partridge in a pear tree.
On the fifth day of Christmas
My true love gave to me:
Five golden rings,
Four calling birds,
Three french hens,
Two turtle doves, and
A partridge in a pear tree.
On the sixth day of Christmas
My true love gave to me:
Six geese a-laying,
Five golden rings,
Four calling birds,
Three french hens,
Two turtle doves, and
A partridge in a pear tree.
On the seventh day of Christmas
My true love gave to me:
Seven swans a-swimming,
Six geese a-laying,
Five golden rings,
Four calling birds,
Three french hens,
Two turtle doves, and
A partridge in a pear tree.
On the eighth day of Christmas
My true love gave to me:
Eight maids a-milking,
Seven swans a-swimming,
Six geese a-laying,
Five golden rings,
Four calling birds,
Three french hens,
Two turtle doves, and
A partridge in a pear tree.
On the ninth day of Christmas
My true love gave to me:
Nine ladies dancing,
Eight maids a-milking,
Seven swans a-swimming,
Six geese a-laying,
Five golden rings,
Four calling birds,
Three french hens,
Two turtle doves, and
A partridge in a pear tree.
On the tenth day of Christmas
My true love gave to me:
Ten lords a-leaping,
Nine ladies dancing,
Eight maids a-milking,
Seven swans a-swimming,
Six geese a-laying,
Five golden rings,
Four calling birds,
Three french hens,
Two turtle doves, and
A partridge in a pear tree.
On the eleventh day of Christmas
My true love gave to me:
Eleven pipers piping,
Ten lords a-leaping,
Nine ladies dancing,
Eight maids a-milking,
Seven swans a-swimming,
Six geese a-laying,
Five golden rings,
Four calling birds,
Three french hens,
Two turtle doves, and
A partridge in a pear tree.
On the twelfth day of Christmas
My true love gave to me:
Twelve drummers drumming,
Eleven pipers piping,
Ten lords a-leaping,
Nine ladies dancing,
Eight maids a-milking,
Seven swans a-swimming,
Six geese a-laying,
Five golden rings,
Four calling birds,
Three french hens,
Two turtle doves, and
A partridge in a pear tree.