Skip to content

Instantly share code, notes, and snippets.

@upbeta01
Last active April 6, 2022 07:27
Show Gist options
  • Save upbeta01/a1e94c1e565fba66f6bb56968de97725 to your computer and use it in GitHub Desktop.
Save upbeta01/a1e94c1e565fba66f6bb56968de97725 to your computer and use it in GitHub Desktop.

Revisions

  1. upbeta01 revised this gist Apr 6, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions xmas-carol.rs
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    // File: main.rs
    fn main() {
    // This code prints the lyrics of the song: "The Twelve Days of Christmas"
    // Sing with me with these lines of code!
  2. upbeta01 created this gist Apr 6, 2022.
    31 changes: 31 additions & 0 deletions xmas-carol.rs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    fn main() {
    // This code prints the lyrics of the song: "The Twelve Days of Christmas"
    // Sing with me with these lines of code!

    let mut count = 0;
    let mut item_checkout: Vec<&str> = Vec::new();
    let days: [&str; 12] = [
    "1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th",
    ];
    let items: [&str; 12] = [
    "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",
    ];

    for day in days {
    item_checkout.insert(0, items[count]);
    count += 1;
    println!("In the {} of Christmas, my true love sent to me..", day);
    println!("\t{:?} \n", item_checkout);
    }
    }