The Scala specification says on page 4 that โ (unicode \u2190 ) is reserved, as is its equivalent to ascii <- which, as others point out, is an iterator for the for loop.
for(x <- 1 to 5) println(i)
In scala, you can enclose a complex expression and treat it as one line with the value indicated at the end of the expression. This makes it possible to create a large nested for loop in which each loop loop increments the iterator at the end of the loop until iterates over the earlier iterator.
Here is an example using the scala shell and both syntaxes:
This is how most people write for the loop
Please note that | character is a line continuation, not typed by me, but inserted into the scala shell
scala> for { | x<-1 to 5 | y<-2 to 6 | } println (x,y) (1,2) (1,3) (1,4) (1,5) (1,6) (2,2) (2,3) ... (5,5) (5,6)
But you can also use this funny Unicode arrow character, and it does the same:
scala> for { | x โ 1 to 5 | y โ 2 to 6 | } println (x,y) (1,2) (1,3) (1,4) (1,5) (1,6) (2,2) (2,3) ... (5,5) (5,6)
You may notice that some of the expressions in this complex for {} block you posted are assignments, not iterations. This allows, and does not break the chain of iterations. Here is a simpler example:
scala> for { | x โ 1 to 3 | y = x*x | z โ 1 to 4 | } println (x,y,z) (1,1,1) (1,1,2) (1,1,3) (1,1,4) (2,4,1) (2,4,2) (2,4,3) (2,4,4) (3,9,1) (3,9,2) (3,9,3) (3,9,4)