How do I continue reading stdin
until "END" string reached, in Scala?
Here's what I've tried:
val text = Iterator.continually(Console.readLine).takeWhile(_ != "END").toString
You should use mkString
instead of toString
here:
val text = Iterator.
continually(Console.readLine).
takeWhile(_ != "END").
mkString("\n")
mkString
on collection aggregates all elements in a string using optional separator.