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.




 
Document A$={1st Line
      2nd line
      3rd line
      }
Save.Doc A$, "test.txt", 0   ' 0 for utf16-le
\\ we use Wide for utf16-le \\ without it we open using ANSI
Open "test.txt" For Wide Input Exclusive as #N
      While Not Eof(#N) {
            Line Input #N, ThisLine$
            Print ThisLine$
      }
Close #N
Clear A$
Load.Doc A$, "test.txt"
\\ print proportional text, all lines
Report A$
\\ Print one line, non proportional
\\ using paragraphs
For i=0 to Doc.par(A$)-1
      Print Paragraph$(A$, i)
Next i
\\ List of current variables (in any scope, public only)
List
 