[Gambas-user] About help and arrays and variables

Demosthenes Koptsis demosthenesk at ...626...
Fri Nov 19 15:26:17 CET 2010


> Normal it's Dynamic array :)
> 
> Dynamic :
> DIM Identifier AS [ NEW ] Native Datatype [ Array dimensions ... ]

So what the difference between 
DIM aInt2 AS Integer[3], DIM aInt2 AS Integer[]
if both are dynamic?

Now my examples tell me if i am right...

Dynamic arrays -------------------------
'locale scope in a SUB
DIM aInt2 AS Integer[3]                'this is a dynamic array
DIM aInt2 AS Integer[] = [1, 2, 3]     'another dynamic array

'global scope in Declarations
PUBLIC aInt2 AS Integer[] = [1, 2, 3]  'more dynamic arrays
PRIVATE aInt2 AS Integer[] = [1, 2, 3]
-------------------------------------------
And now finally static arrays:

Static arrays -----------------------------
'local scope in a SUB
DIM aInt2[10] AS Integer 'this static array is in a SUB!

'global scope in Declarations
PRIVATE aInt2[10] AS Integer ' this static array is ok in declarations
PUBLIC aInt2[10] AS Integer  'this is forbidden in global scope, i get
an error
-------------------------------------------

are these ok?
i think i understood it
except 
DIM aInt2[10] AS Integer 'this static array is in a SUB!



> 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

yes i notice that

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