[Gambas-user] Array constant
Benoit Minisini
gambas at ...1...
Tue May 25 22:14:32 CEST 2004
On Tuesday 25 May 2004 22:03, Fabien Bodard wrote:
> Le mardi 25 Mai 2004 21:00, Grahame White a écrit :
> > Is there anyway to a make a constant array?
> >
> > For example something like:
> >
> > PUBLIC CONST POW2[10] AS Short[] = (1, 2, 4, 8, 16, 32, 64, 128, 256,
> > 512)
> >
> >
> >
> >
> > Grahame
>
> Constants declaration
> ( PUBLIC | PRIVATE ) CONST Identifier AS Datatype = Constant value
>
> This declares a class global constant.
> - This constant is accessible everywhere in the class it is declared.
> - If the PUBLIC keyword is specified, it is also accessible to the other
> classes having a reference to an object of this class.
> - Constant must be booleans, integers, floating point numbers or strings.
>
>
>
>
> no ;-)
>
> Actually you have just the way public variable to define array....
>
> <to benoit> hey, why not a possibility, to define const as class type
> like :
> PUBLIC CONST POW2 AS Short[] = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
>
> or something in this mind.
Do it by hand in the static constructor _init().
STATIC PUBLIC POW2 AS Short[]
STATIC PUBLIC SUB _init()
POW2 = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
END
>
> I've another question.... what about the TYPE keyword ?
There is no TYPE keyword !?
--
Benoit Minisini
mailto:gambas at ...1...
More information about the User
mailing list