[Gambas-user] integer array in struct ?

wally wally at ...2037...
Tue Oct 25 19:33:41 CEST 2011


still question on this integer[][] 
(fear i get senil slowly :)

how to resize a 2D array ?
how to set values in appropriate places ?
what does the array.Bounds do ?
example project attached 

wally


On Tuesday, October 25, 2011 11:44:49 Bruce Bruen wrote:
> On the other hand, the following piece of garbage is also correct.
> Better minds than I will have to tell you what's in the array.
> ' Gambas module file
> 
> Public Struct axis
>   i As Integer
>   f As Float
>   ia As Integer[]
> End Struct
> 
> Public Sub Main()
> 
> Dim testit As New Axis
> Dim x As Integer
> Dim y As Integer
> 
> testit.ia = New Integer[][]
> 
> testit.i = 212
> testit.f = Pi()
> 
> 
> For x = 0 To 120
>   If x Mod 2 = 0 Then
>     testit.ia.Add(x, 0)
>     Print "Seagoon:\tYing ";
>   Else If x Mod 5 = 0
>     testit.ia.Add(x, 1)
>     Print "Tong\nBluebottle:\tTiddle-I-Po"
>   Else
>     testit.ia.Add(x, 2)
>     Print "Tong"
>   Endif
> Next
> Print " Tong\nBluebottle/Seagoon:\tTiidle-i-Po\nAll:\tTiddle-I-Po"
> Print "Grippype-Thin:\tOh Min, that N-n-n-eddy, he'll be the death of us
> yet!"
> End
> 
> Clue! All you have done in the struct is to declare "ia" to be an
> integer array, it's not till you (or any other programmer) instantiates
> it - any old way they like - that it's dimensionality and cardinality is
> decided.
> 
> Good luck!
> Bruce
> ---------------------------------------------------------------------------
> --- The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning at ...2709... Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
-------------- next part --------------
A non-text attachment was scrubbed...
Name: struct_array_gb001-0.0.1.tar.gz
Type: application/x-compressed-tar
Size: 4799 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20111025/e92a994f/attachment.bin>


More information about the User mailing list