Input loop: Difference between revisions

Opening command channel needs to be taken out of loop to avoid "?File Already Open" errors. Also initialize F$ each time, as null input results in F$ retaining last used value.
m (Put Commodore BASIC in alphabetical order for the examples listed under BASIC.)
(Opening command channel needs to be taken out of loop to avoid "?File Already Open" errors. Also initialize F$ each time, as null input results in F$ retaining last used value.)
Line 510:
<lang CommodoreBASICv2>
10 rem input loop - rosetta code
1511 print chr$(147);chr$(14);:rem open command channel, clear screen, switch to lower case
12 open 15,8,15
15 print chr$(147);chr$(14);f$=""
 
20 input "Enter filename";f$
25 if f$="" then end
 
30 open 15,8,15:open 5,8,5,f$+",s,r"
40 gosub 1000
50 if er=62 then print "That file is not found... Try again.":close 5:goto 20
60 if er<>0 then print "There was an unexpected error.":close 5:gosub 1100
 
70 get#5,a$
Line 532 ⟶ 535:
1120 return
</lang>
 
 
 
==={{header|IS-BASIC}}===
113

edits