Skip to content

Instantly share code, notes, and snippets.

@sentientmonkey
Created August 8, 2016 21:45
Show Gist options
  • Save sentientmonkey/1e49533d02ab203483f2e14f209f5b59 to your computer and use it in GitHub Desktop.
Save sentientmonkey/1e49533d02ab203483f2e14f209f5b59 to your computer and use it in GitHub Desktop.
pub fn raindrops(n: u64) -> String {
match (n % 3, n % 5, n % 7) {
(0, 0, 0) => "PlingPlangPlong".to_string(),
(0, 0, _) => "PlingPlang".to_string(),
(0, _, 0) => "PlingPlong".to_string(),
(_, 0, 0) => "PlangPlong".to_string(),
(0, _, _) => "Pling".to_string(),
(_, 0, _) => "Plang".to_string(),
(_, _, 0) => "Plong".to_string(),
(_, _, _) => n.to_string(),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment