Scala - can yield be used multiple times with a for loop?

前端 未结 6 2199
-上瘾入骨i
-上瘾入骨i 2020-12-10 11:56

An example:

val l = List(1,2,3)
val t = List(-1,-2,-3)

Can I do something like this?

for (i <- 0 to 10) yield (l(i)) yie         


        
6条回答
  •  北荒
    北荒 (楼主)
    2020-12-10 12:12

    Maybe yield is not the best way to go? Perhaps simple array appending could be used here.

提交回复
热议问题