[Gambas-user] About help and arrays and variables
Fabien Bodard
gambas.fr at ...626...
Fri Nov 19 14:58:36 CET 2010
2010/11/19 Demosthenes Koptsis <demosthenesk at ...626...>:
> ok!
>
> i was cofused from two things
>
> 1)
> in previous message about static arrays Fabien said that:
>
>>yes a static array is not an object ... that's why it's a little bit
>>deprecated :)
>>
>>
>>anther way :
>>
>>dim htmpArray as integer[]= [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>
>
> so a
> DIM htmpArray as integer[]= [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
> i thought was a static.
no a dynamic ... look at the bottom
>
> and
>
> 2)
> ---------------------------------
> DIM aInt2 AS Integer[3]
>
> aInt2[0] = 1
> aInt2[1] = 20
> aInt2[2] = 30
>
> aInt2.Add(40) 'here is the resize of the array
> aInt2.Add(50)
> aInt2.Add(60)
>
> PRINT aInt2[3]
> PRINT aInt2[4]
> PRINT aInt2[5]
> ---------------------------------
>
> In my gambas2-2.21 rev3300 there is no error, nor compilation nor
> execution!
>
Normal it's Dynamic array :)
Dynamic :
DIM Identifier AS [ NEW ] Native Datatype [ Array dimensions ... ]
ex : dim aInt as Integer[10]
Static
[ STATIC ] { PUBLIC | PRIVATE } Identifier [ Array dimensions ... ] AS
Native Datatype
ex : Private aInt[10] as integer
you can't declare a staic array in a sub
More information about the User
mailing list