The Twelve Days of Christmas

var days = <first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth>
 
var gifts = <<'EOT'.lines
  And a partridge in a pear tree.
  Two turtle doves,
  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,
EOT
 
func nth(n) { say "On the #{days[n]} day of Christmas, my true love gave to me:" }
 
nth(0)
say gifts[0].sub('And a', 'A')
 
for d (1..11) {
    say ''
    nth(d)
    for i flip(0..d) {
        say gifts[i]
    }
}

Output:

Last updated

Was this helpful?