# ## top-line read by every ## ##- # Author: Brian Tiffin # Dedicated to the public domain # # Date: September, 2016 # Modified: 2016-10-03/22:51-0400 ##+ # # every.icn, Demonstrate the every emphatic # procedure main() # so many things to show for every # semantics wise, every continuously fails, causing the Unicon goal # directed evaluation engine to seek alternatives for a successful # expression outcome # write some to-by numbers every writes(0 to 8 by 2) do writes(" ") # write some alternatives write() every write(1 | 2 | "abc") # every out a string, one character at a time every write(!"xyzzy") # 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 may not do what you 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 # do this, with while write() write("### read (the rest) in a while loop ###") write() while now := read(f) do stuff(now) close(f) end procedure stuff(now) write(now) end