object test1 { def main(args: Array[String]): Unit = { val s1 = List("DDD","99990","Shall") println("8"*88+"第一种") for (elem <- s1) {println(elem)} println("8"*88+"第二种") for (elem <- s1) { if(elem.length>3) println(elem) } println("8"*88+"第三种") var s2 = for {elem <- s1 if(elem.length>3) st = elem.toUpperCase() }yield(st) for (elem <- s2) {println(elem)} println("8"*88+"第四种") var i = 0 while(i<s2.length){ println(s2(i)) i+=2 } for (x <- 1 until 20)println(x) } }