[Gambas-user] String[] initialisation

Doriano Blengino doriano.blengino at ...1909...
Sun Mar 1 15:59:02 CET 2009


Ian Haywood ha scritto:
> I would like to initialise a String array to an array of zero elements.
>
> Setting to [] seems to be the same as NULL, which fires an error if .Length or .Push are called.
> Setting to ["foo"] (i.e. to an array of one dummy element), and then calling .Clear ()
> does what I want, but this doesn't look right.
>   
I my be wrong, but I think that: after having created an array, it is 
void (ie, it has no elements), so you have what you want. If, after 
having used it, you want to have it empty again, call Clear(); this 
empties it again. You are true in that "[]" should designate an empty 
array, not NULL. Anyway, the previous statements should work.

Hope it helps -- regards,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."





More information about the User mailing list