[Gambas-user] Referencing an array element with boolean

Patrik Karlsson pata.karlsson at ...626...
Sun Jun 22 07:46:36 CEST 2014


2014-06-21 12:23 GMT+02:00 Benoît Minisini <gambas at ...1...>:

> Le 21/06/2014 09:47, Patrik Karlsson a écrit :
> > 3. I have a "BoolToIndex" function in a library module but I was thinking
> > if it should not be part of the language, to be able to reference in
> > a _simple_ way to an array element with a boolean.
>
> No. But you will be able to do Abs(True).
>
> Moreover, Boolean is, by definition, not a good datatype for indexing!
>
>
Ok, that will be good too, thank you.
In this case indexing on booleans gives me a nice and clean code where I
have many 'either or' for loading the correct string value, sound clip and
image. But I will keep that in mind.

/Patrik



More information about the User mailing list