Gambas/syntax/variables/arrays

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Gambas‎ | syntax‎ | variables
Revision as of 01:41, 27 April 2013 by Woozle (talk | contribs) (since I spent some time figuring this out...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

There are two kinds of arrays in Gambas. One is well-documented, the other barely-documented.

Native Arrays

A "native array" is an array of other variable types; see Array Declaration for documentation and examples.

Array Class

The Array class is an abstract class, which is to say that you cannot use it directly; you have to create a descendant class which implements it and has a public _new() procedure. (Classes have a public _new() procedure by default, so you don't actually have to declare this.)

To inherit from the Array class, simply put "inherits Array" in the class before declaring any functions or procedures. (Actually, I'm not sure if it has to be first, but it seems like good form to have this near the top.)

Once declared, your descendant class will have all the methods and functions defined in the Array class.