Skip to content

Instantly share code, notes, and snippets.

View TheElectronWill's full-sized avatar
🙃
enjoying

Guillaume Raffin TheElectronWill

🙃
enjoying
View GitHub Profile
@TheElectronWill
TheElectronWill / dotty-pling-challenge.scala
Last active August 7, 2019 13:49
Pling Plang Plong! A small programming challenge to test Dotty (Scala 3) new "main methods" feature
@main def challenge(x: Int) = {
val str = Map(3 -> "Pling", 5 -> "Plang", 7 -> "Plong")
.filter((factor, name) => x % factor == 0)
.values
.mkString
println(if (str.nonEmpty) str else x)
}