Accepting Input in a Scala Worksheet
Is it possible to accept user input in a Scala Worksheet? For example:
println("Enter some numbers and press Ctrl-D")
val input = Source.fromInputStream(System.in)
val lines = input.getLines().collect
println("Sum "+sum(lines))
I can type a few lines and press Ctrl-D, and have IntelliJ continue interpreting the worksheet.
请先登录再写评论。
Not, it's not possible for now. Not sure it can be useful. However we will think about it too, when we will rework worksheet feature.
Best regards,
Alexander Podkhalyuzin.