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.
1 comment

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.

0

Please sign in to leave a comment.