Input loop: Difference between revisions

Input loop in various BASIC dialents
(Added solution for Action!)
(Input loop in various BASIC dialents)
Line 519:
 
=={{header|BASIC}}==
==={{header|BASIC256}}===
<lang BASIC256>f = freefile
open f, "test.txt"
 
while not eof(f)
linea$ = readline(f)
print linea$ # echo to the console
end while
close f
end</lang>
 
==={{header|QBasic}}===
{{works with|QBasic}}
{{works with|QuickBasic}}
<lang QBasic>OPEN "test.txt" FOR INPUT AS #1
 
WHILE NOT EOF(1)
INPUT #1, linea$
PRINT linea$ ' echo to the console
WEND
 
CLOSE #1
END</lang>
 
==={{header|True BASIC}}===
<lang qbasic>OPEN #1: NAME "test.txt", ACCESS INPUT
 
DO
LINE INPUT #1: linea$
PRINT linea$ ! echo to the console
LOOP UNTIL END #1
 
CLOSE #1
END</lang>
 
==={{header|Yabasic}}===
<lang yabasic>filename$ = "test.txt"
f = open(filename$)
 
if not f error "Could not open '" + filename$ + "' for reading"
while(not eof(f))
line input #f linea$
print linea$ // echo to the console
wend
 
close f
end</lang>
 
==={{header|Applesoft BASIC}}===
2,122

edits