Input/Output for lines of text: Difference between revisions
Added Kotlin
(Added Kotlin) |
|||
Line 293:
}
}</lang>
=={{header|Kotlin}}==
<lang scala>// version 1.1.0
fun output(lines: Array<String>) = println(lines.joinToString("\n"))
fun main(args: Array<String>) {
println("Enter the number of lines to be input followed by those lines:\n")
val n = readLine()!!.toInt()
val lines = Array<String>(n) { readLine()!! }
println("\nThe lines you entered are:\n")
output(lines)
}</lang>
{{out}}
<pre>
Enter the number of lines to be input followed by those lines:
3
hello
hello world
Pack my Box with 5 dozen liquor jugs
The lines you entered are:
hello
hello world
Pack my Box with 5 dozen liquor jugs
</pre>
=={{header|Lua}}==
|