dart-exercism/raindrops/lib/raindrops.dart
2024-10-14 11:37:17 +02:00

10 lines
316 B
Dart

class Raindrops {
String convert(int factor) {
final StringBuffer result = StringBuffer();
if (factor % 3 == 0) result.write('Pling');
if (factor % 5 == 0) result.write('Plang');
if (factor % 7 == 0) result.write('Plong');
return (result.isEmpty) ? factor.toString() : result.toString();
}
}