Input loop: Difference between revisions
Content added Content deleted
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: | Line 510: | ||
<lang CommodoreBASICv2> |
<lang CommodoreBASICv2> |
||
10 rem input loop - rosetta code |
10 rem input loop - rosetta code |
||
11 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$ |
20 input "Enter filename";f$ |
||
25 if f$="" then end |
25 if f$="" then end |
||
30 |
30 open 5,8,5,f$+",s,r" |
||
40 gosub 1000 |
40 gosub 1000 |
||
50 if er=62 then print "That file is not found... Try again.":goto 20 |
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.":gosub 1100 |
60 if er<>0 then print "There was an unexpected error.":close 5:gosub 1100 |
||
70 get#5,a$ |
70 get#5,a$ |
||
Line 532: | Line 535: | ||
1120 return |
1120 return |
||
</lang> |
</lang> |
||
==={{header|IS-BASIC}}=== |
==={{header|IS-BASIC}}=== |