/** * Created by root * Description : List */ object ListTest { def main(args: Array[String]): Unit = { println() } val a = List(1,2,3,4) for (i <- a) println(i) // 将0添加到a中 val b = 0::a for (i <- b) println(i) val c = List("x","y"…
// Range:to:默认步进为1 val to1 = 1 to 10 println(to1) // 定义一个不进为2的Range val to2 = 1 to 10 by 2 println(to2) println(to2.toList) // Range:until val until1 = 1 until 10 println(until1) val until2 = 1 until 10 by 2 println(until2)…