# ## top-line read by every ## ##- # Author: Brian Tiffin # Dedicated to the public domain # # Date: September, 2016 # Modified: 2016-10-03/22:51-0400 ##+ # # every-gen.icn, Demonstrate the every emphatic with generate elements # procedure main() # write out this file; not always a job for every write() f := open(&file, "r") | stop("Cannot open ", &file, " for read") write("read in an every loop does not do what you may expect") # don't do this every now := read(f) do stuff(now) # read returns a result, not suspend # every succeeds, job complete, after the first record # now using the file itself with the ! operator write() write("### generate (the rest) ###") write() every now := !f do stuff(now) close(f) end procedure stuff(now) write(now) end