The most straight-forward looking approach will just use readLine() which is part of Predef. However that is rather ugly as you need to check for eventual null value.
The most straight-forward looking approach will just use readLine() which is part of Predef. However that is rather ugly as you need to check for eventual null value: object ScannerTest { def main(args: ArrayString) { var ok = true while( ok ) { val ln = readLine() ok = ln! = null if( ok ) println( ln ) } } } this is so verbose, you'd rather use the java.util.
Scanner instead. I think a more pretty approach will use scala.io. Source: object ScannerTest { def main(args: ArrayString) { for( ln GetLines ) println( ln ) } }.
3 Pleease let me work in Scala full time right now! – Martin Konicek Jan 11 at 1:24.
For the console you can use Console.readLine. You can write (if you want to stop on an empty line): Iterator. Continually(Console.
ReadLine). TakeWhile(_! = "").
Foreach(line => println("read " + line)).
I know about Console.readLine(), I am looking for a given recipe . The "scala" way for reading line by line from Standard input . – Andrei Ciobanu Jan 3 at 15:28 I think you mean takeWhile(_!
= null) – Seth Tisue Jan 4 at 17:31 Depends how you want to stop. Looking for an empty line is often the simplest solution. – Landei Jan 4 at 19:57.
Val input = Source. FromInputStream(System. In); val lines = input.getLines.collect.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.