RosettaCodeData/Task/Input-loop/LIL/input-loop.lil

19 lines
564 B
Plaintext

#
# canread test (note that canread is not available in LIL/FPLIL itself
# but provided by the command line interfaces in main.c/lil.pas)
#
# You can either call this and enter lines directly (use Ctrl+Z/Ctrl+D
# to finish) or a redirect (e.g. lil canread.lil < somefile.txt)
#
# Normally this is how you are supposed to read multiple lines from
# the standard input using the lil executable. For an alternative way
# that uses error catching via try see the eoferror.lil script.
#
set count 0
while {[canread]} {
readline
inc count
}
print $count lines