[Gambas-user] read/data commands
Jussi Lahtinen
jussi.lahtinen at ...626...
Thu Jun 27 23:49:30 CEST 2013
Sorry, with your correct variable names;
Dim ii As Integer, jj As Integer
Dim v As New Integer[5, 5]
For ii = 0 To 4
For jj = 0 To 4
v[ii, jj] = jj + 1
Next
Next
On Fri, Jun 28, 2013 at 12:48 AM, Jussi Lahtinen
<jussi.lahtinen at ...626...>wrote:
> I don't quite understand usage of data...
>
> Will this do what you want?
>
> Dim data As Integer[] = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
> Dim v As New Integer[]
>
> v = data.Copy()
>
>
> Or this:
>
> Dim ii As Integer, jj As Integer
> Dim data As New Integer[5, 5]
>
> For ii = 0 To 4
> For jj = 0 To 4
> data[ii, jj] = jj + 1
> Next
> Next
>
>
> Jussi
>
>
>
>
>
>
>
>
> On Thu, Jun 27, 2013 at 10:55 PM, Keith Clark <keithclark at ...2185...>wrote:
>
>> 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
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by Windows:
>>
>> Build for Windows Store.
>>
>> http://p.sf.net/sfu/windows-dev2dev
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
>
More information about the User
mailing list