[Gambas-user] read/data commands
Keith Clark
keithclark at ...2185...
Thu Jun 27 21:55:30 CEST 2013
On 13-06-27 05:34 AM, Tobias Boege wrote:
> On Wed, 26 Jun 2013, Keith Clark wrote:
>> Does Gambas support read/data commands like the following for loading a
>> simple array with fixed values?
>>
>> for t=0 to 4
>> for x = 0 to 4
>> read v(t,x)
>> next x
>> next t
>>
>> data 1,2,3,4,5,1,2,3,4,5,1,2,3,4,5......
>>
>> Maybe I'm just not finding it?
>>
> I don't know what you want to do, actually, and your snippet does not
> resemble Gambas at all... Maybe you want to access elements of a 2D array
> where t is the row and x is the column? So if v is an Integer[][], then you
> need to do:
>
> For t = 0 To 4
> For x = 0 To 4
> Print v[t][x]
> Next
> Next
>
> Regards,
> Tobi
>
>
Yeah, I posted that question rather quickly. I want to fill an array
with a very simple, fixed dataset that will never change. The code I
gave above is from an old dialect, but really just the curved brackets
should have been square.
for t=0 to 4
for x = 0 to 4
read v[t,x]
next x
next t
data 1,2,3,4,5,1,2,3,4,5,1,2,3,4,5......
Would read into the array v the data in the 'data' statement
v[0,0]=1
v[0,1]=2
and so on.
For reference:
http://www.antonis.de/qbebooks/gwbasman/read.html
More information about the User
mailing list