/ howto / useglobalarrays
How to Use Public Arrays

#### Gambas Classical Public Arrays

The Gambas concept for PUBLIC Arrays is, to use Integer[] :

### Examples

    PUBLIC iDynamic AS Integer[]

    PUBLIC SUB Button6_Click()
    DIM iVal AS Integer
    DIM fStarttime AS Float

    iDynamic = NEW Integer[](1000)
    FOR iVal = 0 TO 999
      iDynamic[iVal] = iVal
    NEXT
    PRINT "fill iDynamic "; Timer - fStarttime
    END

    PUBLIC SUB Button7_Click()
    DIM iVal AS Integer
    DIM iSum AS Integer
    DIM fStarttime AS Float

    fStarttime = Timer
    isum = 0
    FOR iVal = 0 TO 999
      iSum = iSum + iDynamic[iVal]
    NEXT
    PRINT "sum iDynamic "; Timer - fStarttime
    END