summaryrefslogtreecommitdiff
path: root/rust-book/xmas/src/main.rs
blob: e725a2600c285f6e18d9a3fa95afd3268a306a7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
fn main() {
    let days = [
        "1st",
        "2nd",
        "3rd",
        "4th",
        "5th",
        "6th",
        "7th",
        "8th",
        "9th",
        "10th",
        "11th",
        "12th",
    ];
    let 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",
    ];

    // for each day
    for mut each in 0..12 {
        println!("\nOn the {} day of Christmas,", days[each]);
        println!("My true love gave to me");

        // print associated lyrics
        for i in (0..each+1).rev() {
            println!("{}", gifts[i]);
        }

    }
}