Done as part of practicing the 3.5 Control Flow section of the official Rust documentation which has users to try to build certain programs to practice what they learned.
This program can be used via CLI. It prints the full lyrics of "A Song And A Christmas Tree (The Twelve Days of Christmas) by Andy Williams" taking advantage of the lyrical repetitions in the song.
Clone the project
git clone https://link-to-project
Go to the project directory
cd rust-cli-twelve-days-of-christmas
Build & Run
cargo run
$ cargo run
Compiling twelve-days-of-christmas v0.1.0 (/Users/ahutanu/production/rust/twelve-days-of-christmas)
Finished dev [unoptimized + debuginfo] target(s) in 0.60s
Running `target/debug/twelve-days-of-christmas`
On the 1st day of Christmas
My good friends brought to me
A song and a Christmas tree
On the 2nd day of Christmas
My good friends brought to me
Two candy canes
And a song and a Christmas tree
On the 3rd day of Christmas
My good friends brought to me
Three boughs of holly
Two candy canes
And a song and a Christmas tree
On the 4th day of Christmas
My good friends brought to me
Four colored lights
Three boughs of holly
Two candy canes
And a song and a Christmas tree
On the 5th day of Christmas
My good friends brought to me
A shining star
Four colored lights
Three boughs of holly
Two candy canes
And a song and a Christmas tree
On the 6th day of Christmas
My good friends brought to me
Little silver bells
A shining star
Four colored lights
Three boughs of holly
Two candy canes
And a song and a Christmas tree
On the 7th day of Christmas
My good friends brought to me
Candles a-glowing
Little silver bells
A shining star
Four colored lights
Three boughs of holly
Two candy canes
And a song and a Christmas tree
On the 8th day of Christmas
My good friends brought to me
Gold and silver tinsel
Candles a-glowing
Little silver bells
A shining star
Four colored lights
Three boughs of holly
Two candy canes
And a song and a Christmas tree
On the 9th day of Christmas
My good friends brought to me
A guardian angel
Gold and silver tinsel
Candles a-glowing
Little silver bells
A shining star
Four colored lights
Three boughs of holly
Two candy canes
And a song and a Christmas tree
On the 10th day of Christmas
My good friends brought to me
Some mistletoe
A guardian angel
Gold and silver tinsel
Candles a-glowing
Little silver bells
A shining star
Four colored lights
Three boughs of holly
Two candy canes
And a song and a Christmas tree
On the 11th day of Christmas
My good friends brought to me
Gifts for one and all
Some mistletoe
A guardian angel
Gold and silver tinsel
Candles a-glowing
Little silver bells
A shining star
Four colored lights
Three boughs of holly
Two candy canes
And a song and a Christmas tree
On the 12th day of Christmas
My good friends brought to me
All their good wishes
Gifts for one and all
Some mistletoe
A guardian angel
Gold and silver tinsel
Candles a-glowing
Little silver bells
A shining star
Four colored lights
Three boughs of holly
Two candy canes
And a song and a Christmas tree
This project is meant as a playground to practice the Rust programming language while following the official documentation. The author has no previous experience with Rust and this has been developed with knowledge acquired in Rust by following up until the 3.5 Control Flow section of the official Rust documentation. If further concepts that may improve this program at later chapters are learned, this program will not be refactored to use the new concepts, but rather new programs will be built. Please consider this when reviewing the code.