[Gambas-user] Why is val() so roundabout?
Eilert
eilert-sprachen at ...221...
Tue Jun 21 17:54:27 CEST 2005
One thing that really is uncomfortable in Gambas is that val() does not
only return Zero when there is nothing to do, but Null.
Null is a thing that cannot be evaluated without a lot of extra code.
Sometimes, strings to be converted into values contain nothing or
characters or stuff. In these cases, a simple Zero would do -
val("Gambas") = "Zero" or val("34 hello") = "34" is easier to handle
than a "maybe it will return a value, but maybe it won't".
I've tried to compensate for some cases in my current project where
there were errors stopping the program because someone had entered
something else than a number. I only found a solution for an empty
string (if mystring <> "" then...), but not for the case there is
something else than a number in the string.
So, is there a reason for this behaviour (maybe a question directly
going to Benoit - hey, what about your finger?), or is it a bug?
Rolf
More information about the User
mailing list