11 June 2013

Scala notes 9: left arrow operator definition and example

Information: THIS IS NOT TUTORIAL.
Scala notes is series of my "side comments" that can be useful during learning Scala.
Their contains bunch of information about interesting bits, explanation of things that i didn't come across yet or attempt to explain things which i didn't understand.

<- left-arrow operator is called generator.
It is called a generator, because "it is 'generating individual values' from a collection used in an expression.
for example:
package lab

object LeftArrowGenerator {

def main(args: Array[String]): Unit = {

val zoo = List("Wolf", "Giraffe", "Elepthant", "Gepard", "Lion", "Owl", "Pather")

for (animal <- zoo) {
println(animal)
}

}

}

No comments:

Post a Comment