ook
New Member
Posts: 1
|
Post by ook on Oct 31, 2018 13:01:33 GMT -5
Hello All
I have a Spectrum BASIC background. In Spectrum BASIC, when reading data into an array, you can use the following :
10 DIM l$(3) 20 FOR n = 1 to 3 30 READ l$(n) 40 NEXT n 50 data "array 1","array 2","array 3"
And away you go.
In Just BASIC v1.01 I can't get the above to work. Apparently you have to do the following :
Dim l$(3) Let l$(1)="string 1" Let l$(2)="string 2" Let l$(3)="string 3"
It do get really cumbersome if you have a couple of strings to add to this array. Isn't there a quicker way of doing it eg creating a csv file and reading that into the array?
Regards
Ook
|
|
|
Post by tenochtitlanuk on Oct 31, 2018 13:30:29 GMT -5
See the help files-- Reading DATA into Arrays DATA is READ into variables. It cannot be READ directly into arrays. To fill arrays with DATA items, first READ the item into a variable, then use that variable to fill an index of the array. EDIT You say you are using JB, where this reply holds. In LB you CAN read data directly...
dim l$( 3)
for n = 1 to 3 read d$ l$( n) =d$ next n
data "array 1", "array 2", "array 3"
|
|