Untitled

mail@pastecode.io avatar
unknown
plain_text
6 days ago
814 B
4
Indexable
Never
fn main() {
    let verses = vec!("And a partridge in a pear tree", "Two turtle doves", "Three French hens",
    "Four calling birds", "Five gold 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");

    let days = vec!("first", "second", "third", "fourth", "fifth", "sixth", "seventh",
    "eighth", "ninth", "tenth", "eleventh", "twelfth");

    for i in 0..12 {
        println!("On the {} day of Christmas my true love sent to me", days[i]);

        if i == 0 {
            println!("A partridge in a pear tree");
        } else {
            for verse in (0..=i).rev() {
                println!("{}", verses[verse]);
            }
        }
        println!("\n")
    }
}
Leave a Comment