File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 1+ pub const LYRIC : [ & str ; 11 ] = [
2+ "Two turtle doves," ,
3+ "Three French hens," ,
4+ "Four calling birds," ,
5+ "Five golden rings," ,
6+ "Six geese a-laying," ,
7+ "Seven swans a-swimming," ,
8+ "Eight maids a-milking," ,
9+ "Nine ladies dancing," ,
10+ "Ten lords a-leaping," ,
11+ "Eleven pipers piping," ,
12+ "Twelve drummers drumming," ,
13+ ] ;
Original file line number Diff line number Diff line change 1+ mod lyric;
2+
3+ // ======================================================================
4+
15fn main ( ) {
2- println ! ( "Hello, world!" ) ;
6+ let mut lyric_lines: Vec < String > = Vec :: new ( ) ;
7+
8+ println ! ( "{}" , print_lyric( & lyric_lines) ) ;
9+ for section in lyric:: LYRIC {
10+ lyric_lines. insert ( 0 , section. to_string ( ) ) ;
11+ println ! ( "{}" , print_lyric( & lyric_lines) ) ;
12+ }
13+ }
14+
15+ fn print_lyric ( lyric_lines : & [ String ] ) -> String {
16+ let lyric_text = lyric_lines. join ( "\n " ) ;
17+ return format ! (
18+ "On the first day of Christmas,\n my true love gave to me\n {lyric_text}\n A partridge in a pear tree.\n "
19+ ) ;
320}
You can’t perform that action at this time.
0 commit comments