Home »
Code Examples »
Scala Code Examples
Scala - How to read more than one integer in one line in and get them in one variable each? Code Example
The code for How to read more than one integer in one line in and get them in one variable each?
// You could use the following code which will read a line
// and use the first 3 whitespace separated tokens as the input.
// (Expects e.g. "1 2 3" as the input on one line)
val Array(m,n,d) = readLine.split(" ").map(_.toInt)