baramuse wrote: ↑Tue Jan 23, 2024 4:25 pm
Thanks but if I'd like to set its default to an empty array instead of a null is that possible ?
If not I can change the logic in the function to handle the list as null instead of empty.
I don't think that's possible, because this requires a complex expression (array creation, even if empty) for the default value, and that's not allowed due to the way default values are implemented. Unless Robert has a smart idea that I'm not thinking of...
But why don't you do something like this instead:
Code: Select all
METHOD CheckStructure(Liste := NULL AS ARRAY OF SYMBOL) AS LOGIC STRICT
IF Liste == NULL
Liste := {}
END IF
? ALen(Liste)
baramuse wrote: ↑Tue Jan 23, 2024 4:25 pm
Also shouldn't I check it with List IS NULL instead of List == NULL ?
Or maybe it's not supported by the compiler yet ?
The IS keyword is different, it is used to compare against a type, if a variable or expression is of a certain type, like Liste IS ArrayList. In this case, you need to check if the variable has a
value of NULL, so you need to use the equality operator.