Input loop is part of Short Circuit's Console Program Basics selection.
Task

Read from a text stream either word-by-word or line-by-line until the stream runs out of data.

The stream will have an unknown amount of data on it.




/* NetRexx */
options replace format comments java crossref symbols nobinary
 
-- Read from default input stream (console) until end of data
lines = ''
lines[0] = 0
lineNo = 0
 
loop label ioloop forever
  inLine = ask
  if inLine =  null  then leave ioloop -- stop on EOF (Try Ctrl-D on UNIX-like systems or Ctrl-Z on Windows)
  lineNo = lineNo + 1
  lines[0] = lineNo
  lines[lineNo] = inLine
  end ioloop
 
loop l_ = 1 to lines[0]
  say l_.right(4)':' lines[l_]
  end l_
 
return
 