Untitled

mail@pastecode.io avatar
unknown
plain_text
15 days ago
952 B
2
Indexable
Never
fn main() {
    let verses = ["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"];

    for mut i in 0..12 {
        if i == 0 {
            println!("On the 1st day of Christmas my true love sent to me");
            println!("A partridge in a pear tree")
        } else if i == 1 {
            println!("On the 2nd day of Christmas my true love sent to me");
            for item in verses {
                println!("{}", verses[i]);
                i -= 1;      
            }
        } else if i == 2 {
            println!("On the 3rd day of Christmas my true love sent to me");

        } else {
            println!("On the {}th day of Christmas my true love sent to me", i+1);
        }
    } 
}
Leave a Comment