0

Possible Duplicate:
Scala “<-” for comprehension

Could someone please explain how the <- operator in Scala works, or at least point me to a link. Someone tweeted a Scala tip: use <- instead of flatmap. Cool but how?

Community
  • 1
  • 1
Jack
  • 16,506
  • 19
  • 100
  • 167

1 Answers1

5

for-comprehension (<-) is just a syntactic sugar for composition of multiple collection-like operations (foreach, map, flatMap, filter etc.)

This is a good article that explains what for-comprehensions translate into:

http://docs.scala-lang.org/tutorials/FAQ/yield.html

elk
  • 442
  • 3
  • 7