0
可能重复:
Scala Punctuation (aka symbols, operators)使用 ' - >' 和 '< - ' 在斯卡拉运营商
什么是->
和<-
运营商在斯卡拉的目的是什么?是否有任何有用的文件,解释在scala中使用的各种运营商 - 我似乎越来越困惑,太往往:)
可能重复:
Scala Punctuation (aka symbols, operators)使用 ' - >' 和 '< - ' 在斯卡拉运营商
什么是->
和<-
运营商在斯卡拉的目的是什么?是否有任何有用的文件,解释在scala中使用的各种运营商 - 我似乎越来越困惑,太往往:)
这两个运营商是非常不同的。
->
运算符用于制作Tuple2
。
scala> 1 -> 2
res0: (Int, Int) = (1,2)
的<-
用于在for语句的意思是这样“中”。所以下面的方法,在每个someList
x
,打印x
:
for(x <- someList) println(x)
要搜索斯卡拉符号,如“ - >”在堆栈溢出,你可以使用http://symbolhound.com/。 要搜索Scala文档,您可以使用http://scalex.org/。 – oluies