Input loop: Difference between revisions

Content added Content deleted
(Add SmallBASIC)
(Added OmniMark solution)
 
Line 2,461:
 
<syntaxhighlight lang="oforth">: readFile(filename) File new(filename) apply(#println) ; </syntaxhighlight>
 
=={{header|OmniMark}}==
 
This OmniMark script will output the file text.txt verbatim, reading it one line at a time:
 
<syntaxhighlight lang="omnimark">
;command line: omnimark -sb Input-loop.xom text.txt
process
repeat scan file #args
match any-text+ => line white-space
output '%x(line)%n'
again
</syntaxhighlight>
 
That would be less common than using #main-input and find rule(s), noting the following effectively produces the same result:
 
<syntaxhighlight lang="omnimark">
;command line: omnimark -sb Input-loop.xom text.txt
process
submit #main-input
 
find any-text+ => line
output line
</syntaxhighlight>
 
=={{header|Oz}}==