0

I am new in scala and was working with a few basic concepts. There are quite a few symbols used in scala, and few of them are still not very clear to me. I found this useful guide that has a summary of the various scala symbols. I don't clearly get the meaning of the following symbol (<-):

for (arg <- args)

A few documents that I found say "Used in for comprehensions in generator expressions". But I don't really understand what it means. Could somebody help me with this. Thank you in advance.

Yuval Itzchakov
  • 146,575
  • 32
  • 257
  • 321
Goldengirl
  • 957
  • 4
  • 10
  • 30
  • 6
    answered by: http://stackoverflow.com/questions/9891407/getting-the-desugared-part-of-a-scala-for-comprehension-expression – Gabriele Petronella Apr 27 '16 at 11:05
  • 1
    Try to read as `element of`. So: `for (arg elment of args) { doSomething}` – Nabil A. Apr 27 '16 at 11:11
  • @NabilA. that's very limited to containers. It has a much broader semantic that applies to anything with a `flatMap` – Gabriele Petronella Apr 27 '16 at 12:38
  • @GabrielePetronella I know. But this works fine for scala standard classes as `Collections`, `Option`, `Try` and `Future`. This was a comment to help a beginner not a paragraph in a book. – Nabil A. Apr 27 '16 at 12:57

0 Answers0