[Gambas-user] About help and arrays and variables

Fabien Bodard gambas.fr at ...626...
Fri Nov 19 16:48:08 CET 2010


2010/11/19 Demosthenes Koptsis <demosthenesk at ...626...>:
> 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?
yes

For the other question

in internal when you wrote :
dim tictactoe as interger[3]
gambas do :
Dim TicTacToe as New Integer[]
TicTacToe.resize(3)


When you wrote

Dim TicTacToe as Integer[]
You have give a type to TicTacToe but you need then to instanciate a
new array and assing it to this variable
by

TicTacToc = New Integer[]


A dynamic array is an object you can pass it throught procedure byref
and between classes ... it's really powerfull.. it's an object :)




More information about the User mailing list