[Gambas-user] Why is val() so roundabout?

Rob sourceforge-raindog2 at ...94...
Tue Jun 21 19:39:02 CEST 2005


On Tuesday 21 June 2005 11:54, Eilert wrote:
> One thing that really is uncomfortable in Gambas is that val() does
> not only return Zero when there is nothing to do, but Null.

In some other language (might have been VB, might not have), I got 
around this by writing a ValNoNull sub, something like this:

PUBLIC FUNCTION ValNN(instring as String) as Float

  IF IsNull(val(instring)) THEN
    RETURN 0
  ELSE
    RETURN val(instring)
  ENDIF

END

Rob






More information about the User mailing list