Neden Scala? yazısı için örnek Scala kodu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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