Input/Output for lines of text: Difference between revisions

Content added Content deleted
(→‎{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details)
Line 295: Line 295:


=={{header|Kotlin}}==
=={{header|Kotlin}}==
<lang scala>// version 1.1.0
<lang scala>// version 1.1


fun output(lines: Array<String>) = println(lines.joinToString("\n"))
fun output(lines: Array<String>) = println(lines.joinToString("\n"))
Line 302: Line 302:
println("Enter the number of lines to be input followed by those lines:\n")
println("Enter the number of lines to be input followed by those lines:\n")
val n = readLine()!!.toInt()
val n = readLine()!!.toInt()
val lines = Array<String>(n) { readLine()!! }
val lines = Array(n) { readLine()!! }
println("\nThe lines you entered are:\n")
println("\nThe lines you entered are:\n")
output(lines)
output(lines)