tracks/groovy/exercises/raindrops/Example.groovy in trackler-2.0.1.0 vs tracks/groovy/exercises/raindrops/Example.groovy in trackler-2.0.1.1

- old
+ new

@@ -1,13 +1,13 @@ class Raindrops { - private def primeSounds = [ 3:'Pling', 5:'Plang', 7:'Plong'] - def convert(num) { - def result = new String() + private def primeSounds = [ 3:'Pling', 5:'Plang', 7:'Plong'] - primeSounds.each({ k, v -> - if ((num % k).equals(0)) { result += v } - }) + def convert(num) { + def result = new String() + primeSounds.each({ k, v -> + if ((num % k).equals(0)) { result += v } + }) + result.isEmpty() ? num.toString() : result + } - result.isEmpty() ? num.toString() : result - } }