[Gambas-user] About help and arrays and variables

Demosthenes Koptsis demosthenesk at ...626...
Fri Nov 19 15:34:02 CET 2010


as i think it now

the word STATIC is not for declaration static arrays but

If the STATIC keyword is specified, the same variable will be shared
with every object of this class.

i get this from variable syntax, same for arrays which they are a set of
variables.

A static array is declared as

PRIVATE TicTacToe[3] AS Integer
STATIC PRIVATE TicTacToe[3] AS Integer

A dynamic arrays is declared as

DIM TicTacToe AS Integer[3]
DIM TicTacToe AS Integer[]
DIM TicTacToe AS NEW Integer[]
PUBLIC TicTacToe AS Integer[3]
PUBLIC TicTacToe AS Integer[]
PRIVATE TicTacToe AS Integer[3]

am i right Fabien?

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
> If array notation is on Data type, array is DYNAMIC
> 
> 
> >> 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