十二天
该程序可将用《 Rust》编写的《圣诞节十二天》中的歌词打印出来。
回答第3章中提出的第三个挑战的答案。
跑
克隆存储库并在其根目录下运行:
cargo run
样品输出
该代码输出以下使用循环:
On the first day of Christmas, my true love gave to me
a partridge in a pear tree
On the second day of Christmas, my true love gave to me
two turtle doves
and a partridge in a pear tree
On the third day of Christmas, my true love gave to me
three French hens
two turtle doves
and a partridge in