|
@ -1,11 +1,11 @@ |
|
|
pub fn build_proverb(list: &[&str]) -> String {
|
|
|
pub fn build_proverb(list: &[&str]) -> String {
|
|
|
let mut verse = "".to_string();
|
|
|
let mut verse = "".to_string();
|
|
|
|
|
|
|
|
|
if !list.is_empty() {
|
|
|
|
|
|
|
|
|
if let Some(nail) = list.first() {
|
|
|
for item in list.windows(2) {
|
|
|
for item in list.windows(2) {
|
|
|
verse.push_str(&format!("For want of a {} the {} was lost.\n", item[0], item[1]));
|
|
|
verse.push_str(&format!("For want of a {} the {} was lost.\n", item[0], item[1]));
|
|
|
}
|
|
|
}
|
|
|
verse.push_str(&format!("And all for the want of a {}.", list[0]));
|
|
|
|
|
|
|
|
|
verse.push_str(&format!("And all for the want of a {}.", nail));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
verse
|
|
|
verse
|
|
|