[Gambas-user] About help and arrays and variables

Stephen Bungay sbungay at ...981...
Thu Dec 16 17:07:54 CET 2010


On 11/19/2010 08:58 AM, Fabien Bodard wrote:
> 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
    I am converting some older code over and came across this 
idiosyncrasy with static arrays in subs, I can work around it easily 
enough but my curiosity is peaked... why are static arrays not allowed 
at the procedure level?
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2&  L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev
> _______________________________________________
> 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