Input/Output for lines of text: Difference between revisions

(Added Kotlin)
Line 379:
do-stuff $line;
}</lang>
 
=={{header|Phix}}==
<lang Phix>sequence stack = {}
procedure push(string line)
stack = append(stack,line)
end procedure
 
procedure pop_all()
while length(stack) do
puts(1,stack[1])
stack = stack[2..$]
end while
end procedure
 
string line = gets(0)
sequence r = scanf(trim(line),"%d")
if length(r)!=1 then
puts(1,"input not a number\n")
abort(0)
end if
puts(1,"\n")
for i=1 to r[1][1] do
line = gets(0)
push(line)
puts(1,"\n")
end for
puts(1,"===\n")
pop_all()</lang>
{{out}}
(or more accurately the final state of the console)
<pre>
3
one
two
three
===
one
two
three
</pre>
 
=={{header|PowerShell}}==
7,806

edits