Exercism: Rust version of the 'Raindrops' exercise.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
265 B

pub fn raindrops(n: u32) -> String {
let mut res = String::new();
if n % 3 == 0 { res.push_str("Pling"); }
if n % 5 == 0 { res.push_str("Plang"); }
if n % 7 == 0 { res.push_str("Plong"); }
if res.is_empty() { return n.to_string() }
res
}