Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let days = ["first","second","third","fourth","fifth","sixth",
- "seventh", "eighth", "ninth", "tenth", "eleventh",
- "twelth"];
- let presents = ["a partridge in a pear tree", "2 turtle doves",
- "3 french hens", "4 calling birds", "5 golden rings",
- "6 geese a laying", "7 swans a swimming",
- "8 maids a milking", "9 ladies dancing",
- "10 lords a leaping", "11 pipers piping",
- "12 drummers drumming"];
- for day in 0..12 {
- println!("On the {} day of Christmas my true love gave to me...",
- days[day]);
- for p in (0..day+1).rev() {
- if p == 0 {
- println!(" {}{}.", if day != 0 { "and " } else { "" },
- presents[p]);
- } else {
- println!(" {},", presents[p]);
- }
- }
- println!("");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement