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

Version Path
trackler-2.2.1.179 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.178 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.177 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.176 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.175 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.174 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.173 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.172 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.171 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.170 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.169 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.167 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.166 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.165 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.164 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.163 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.162 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.161 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.160 tracks/rust/exercises/proverb/example.rs
trackler-2.2.1.159 tracks/rust/exercises/proverb/example.rs