Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Neden Scala? yazısı için örnek Scala kodu
case class Insan(yas: Int)
object NedenScala {
def main(args: Array[String]) {
val insanlar = for (i <- 1 to 10) yield Insan(scala.util.Random.nextInt(30) + 5)
println("İnsanlar:")
insanlar foreach println
println("Yaşları toplamı:")
println(insanlar.foldLeft(0)(_ + _.yas))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.