Champions_2002 Posted October 8, 2007 Share Posted October 8, 2007 How do i basic to read a list of data and then print the list to the screen Quote Link to comment Share on other sites More sharing options...
joyfulcoder Posted October 8, 2007 Share Posted October 8, 2007 How do i basic to read a list of data and then print the list to the screen Here is a small example of reading data in Atari BASIC using DATA statements. I chose to use a "dummy" data value to detect the end of data but there are other ways of doing this. I hope this helps. 10 DIM S$(20) 100 RESTORE 500:C=0 110 READ I 120 IF I=-1 THEN 200 130 READ R,S$:C=C+1 140 ? I;" ";R;" ";S$ 150 GOTO 110 200 ? C;" items read" 210 END 500 DATA 1,1.1,one 510 DATA 2,2.2,two 520 DATA 3,3.3,three 530 DATA 4,4.4,four 540 DATA -1 Quote Link to comment Share on other sites More sharing options...
Rybags Posted October 8, 2007 Share Posted October 8, 2007 (edited) Atari BASIC is slightly different with strings so far as DATA goes. Most BASICs actually require you to enclose them in quotes. Atari BASIC just reads the quotes as if it was part of the data. Also, the DATA statement has to be the last one on a line. e.g. 1000 DATA A,B,C,D:GOTO 2000 would not execute the GOTO, it would be read as a string of value D:GOTO 2000 The quote thing does have an up/downside. Upside is you can embed quotes in your strings easily. Downside is you can't embed commas in the string - you have to set them by other means. Edited October 8, 2007 by Rybags Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.