Sha256: 818f88b58642b094f0ec73b2666d374f9872d3aab25a3f9e79141271fc37cfdd
Contents?: true
Size: 481 Bytes
Versions: 118
Compression:
Stored size: 481 Bytes
Contents
pub fn build_proverb(items: Vec<&str>) -> String { let mut stanzas = Vec::with_capacity(items.len()); for index in 0..items.len() { if index == items.len() - 1 { stanzas.push(format!("And all for the want of a {}.", items[0])); } else { stanzas.push(format!( "For want of a {} the {} was lost.", items[index], items[index + 1] )); } } stanzas.join("\n") }
Version data entries
118 entries across 118 versions & 1 rubygems