[Gambas-user] About help and arrays and variables

Demosthenes Koptsis demosthenesk at ...626...
Fri Nov 19 15:40:07 CET 2010


On Fri, 2010-11-19 at 15:17 +0100, Simonart Dominique wrote:
> Le 19/11/2010 14:58, Fabien Bodard a écrit :
> > 2010/11/19 Demosthenes Koptsis<demosthenesk at ...626...>:
> >> ok!
> >>
> >> i was cofused from two things
> >>
> Hi all,
> 
> I tend to get a little confused too!
> 
> Are these assumptions correct?
> 
> If array notation is on Variable name, array is STATIC
PRIVATE TicTacToe[3] AS Integer 'a static array
> If array notation is on Data type, array is DYNAMIC
PRIVATE TicTacToe AS Integer[] 'a dynamic array

> >> 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
> >
> 
> 
> 
> ------------------------------------------------------------------------------
> 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