Immutable Lists in Scala
问题 I am just trying to figure out how immutable things like a List are working, and how I can add things to it? I am very sorry for asking such dumb questions, but why is here my list always empty when printing it out? var end = false val list = List() while (!end) { val input = scala.io.StdIn.readLine("input:") if (input == "stop" ) end = true else input :: list } println(list) } Sorry for my inconvenience and this rather stupid question! 回答1: I am just trying to figure out how immutable things