RosettaCodeData/Task/Synchronous-concurrency/Crystal/synchronous-concurrency.cr
2024-10-16 18:07:41 -07:00

16 lines
230 B
Crystal

File.write("input.txt", "a\nb\nc")
lines = Channel(String).new
spawn do
File.each_line("input.txt") do |line|
lines.send(line)
end
lines.close
end
while line = lines.receive?
puts line
end
File.delete("input.txt")