Input/Output for lines of text: Difference between revisions

Added Wren
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
(Added Wren)
Line 738:
end for
</lang>
 
=={{header|Wren}}==
This assumes that both Stdin and Stdout are connected to a terminal.
<lang ecmascript>import "io" for Stdin
 
var output = Fn.new { |lines| System.print(lines.join("\n")) }
 
var n = Num.fromString(Stdin.readLine())
if (!n || !n.isInteger || n < 1) Fiber.abort("Number of lines must be a positive integer.")
var lines = List.filled(n, "")
for (i in 0...n) lines[i] = Stdin.readLine()
System.print()
output.call(lines)</lang>
 
{{out}}
Sample input/output:
<pre>
3
hello
hello world
Pack my Box with 5 dozen liquor jugs
 
hello
hello world
Pack my Box with 5 dozen liquor jugs
</pre>
 
=={{header|zkl}}==
9,476

edits