scala for loop until code example
Example 1: how loop in scala
for ((name, count) <- names.zipWithIndex) {
println(s"$count is $name")
}
Example 2: how loop in scala
val names2 = for (e <- names) yield e.capitalize
for ((name, count) <- names.zipWithIndex) {
println(s"$count is $name")
}
val names2 = for (e <- names) yield e.capitalize