summaryrefslogtreecommitdiff
path: root/xmas
diff options
context:
space:
mode:
authorAdam Carpenter <adam.carpenter@adp.com>2019-02-11 16:59:01 -0500
committerAdam Carpenter <adam.carpenter@adp.com>2019-02-11 16:59:01 -0500
commitef1bf4921ee4127d461eec03a14c9070d193345c (patch)
treeab9f4ed73fcf97656743c959ce8c9adbe2ce9924 /xmas
downloadlearning-rust-ef1bf4921ee4127d461eec03a14c9070d193345c.tar.xz
learning-rust-ef1bf4921ee4127d461eec03a14c9070d193345c.zip
Init.
Diffstat (limited to 'xmas')
-rw-r--r--xmas/.gitignore2
-rw-r--r--xmas/Cargo.lock4
-rw-r--r--xmas/Cargo.toml7
-rw-r--r--xmas/out.txt114
-rw-r--r--xmas/src/main.rs42
5 files changed, 169 insertions, 0 deletions
diff --git a/xmas/.gitignore b/xmas/.gitignore
new file mode 100644
index 0000000..53eaa21
--- /dev/null
+++ b/xmas/.gitignore
@@ -0,0 +1,2 @@
+/target
+**/*.rs.bk
diff --git a/xmas/Cargo.lock b/xmas/Cargo.lock
new file mode 100644
index 0000000..033bd72
--- /dev/null
+++ b/xmas/Cargo.lock
@@ -0,0 +1,4 @@
+[[package]]
+name = "xmas"
+version = "0.1.0"
+
diff --git a/xmas/Cargo.toml b/xmas/Cargo.toml
new file mode 100644
index 0000000..d10c790
--- /dev/null
+++ b/xmas/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "xmas"
+version = "0.1.0"
+authors = ["Adam Carpenter <adam.carpenter@adp.com>"]
+edition = "2018"
+
+[dependencies]
diff --git a/xmas/out.txt b/xmas/out.txt
new file mode 100644
index 0000000..55ae012
--- /dev/null
+++ b/xmas/out.txt
@@ -0,0 +1,114 @@
+
+On the 1st day of Christmas,
+My true love gave to me
+A partridge in a pear tree
+
+On the 2nd day of Christmas,
+My true love gave to me
+Two turtle doves and
+A partridge in a pear tree
+
+On the 3rd day of Christmas,
+My true love gave to me
+Three French hens
+Two turtle doves and
+A partridge in a pear tree
+
+On the 4th day of Christmas,
+My true love gave to me
+Four calling birds
+Three French hens
+Two turtle doves and
+A partridge in a pear tree
+
+On the 5th day of Christmas,
+My true love gave to me
+Five golden rings
+Four calling birds
+Three French hens
+Two turtle doves and
+A partridge in a pear tree
+
+On the 6th day of Christmas,
+My true love gave to me
+Six geese a-laying
+Five golden rings
+Four calling birds
+Three French hens
+Two turtle doves and
+A partridge in a pear tree
+
+On the 7th day of Christmas,
+My true love gave to me
+Seven swans a-swimming
+Six geese a-laying
+Five golden rings
+Four calling birds
+Three French hens
+Two turtle doves and
+A partridge in a pear tree
+
+On the 8th day of Christmas,
+My true love gave to me
+Eight maids a-milking
+Seven swans a-swimming
+Six geese a-laying
+Five golden rings
+Four calling birds
+Three French hens
+Two turtle doves and
+A partridge in a pear tree
+
+On the 9th day of Christmas,
+My true love gave to me
+Nine ladies dancing
+Eight maids a-milking
+Seven swans a-swimming
+Six geese a-laying
+Five golden rings
+Four calling birds
+Three French hens
+Two turtle doves and
+A partridge in a pear tree
+
+On the 10th day of Christmas,
+My true love gave to me
+Ten lords a-leaping
+Nine ladies dancing
+Eight maids a-milking
+Seven swans a-swimming
+Six geese a-laying
+Five golden rings
+Four calling birds
+Three French hens
+Two turtle doves and
+A partridge in a pear tree
+
+On the 11th day of Christmas,
+My true love gave to me
+Eleven pipers piping
+Ten lords a-leaping
+Nine ladies dancing
+Eight maids a-milking
+Seven swans a-swimming
+Six geese a-laying
+Five golden rings
+Four calling birds
+Three French hens
+Two turtle doves and
+A partridge in a pear tree
+
+On the 12th day of Christmas,
+My true love gave to me
+Twelve drummers drumming
+Eleven pipers piping
+Ten lords a-leaping
+Nine ladies dancing
+Eight maids a-milking
+Seven swans a-swimming
+Six geese a-laying
+Five golden rings
+Four calling birds
+Three French hens
+Two turtle doves and
+A partridge in a pear tree
diff --git a/xmas/src/main.rs b/xmas/src/main.rs
new file mode 100644
index 0000000..e725a26
--- /dev/null
+++ b/xmas/src/main.rs
@@ -0,0 +1,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]);
+ }
+
+ }
+}