> ' and ' <
Possible Duplicate:
Scala Punctuation (aka symbols, operators)
What is the purpose of ->
and <-
operators in scala? And is there any useful document that explaing the various operators used in scala - I seem to to be getting confused too much, too often :)
The two operators are very different.
The ->
operator is used to make a Tuple2
.
scala> 1 -> 2
res0: (Int, Int) = (1,2)
The <-
is used in for-statements to mean something like "in". So the following means, for each x
in someList
, print x
:
for(x <- someList) println(x)
链接地址: http://www.djcxy.com/p/72834.html
上一篇: 什么这个scala符号
下一篇: >'和'<