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

Eilert eilert-sprachen at ...221...
Wed Jun 22 08:42:39 CEST 2005


This is a good idea, although it takes yet another function to 
implement. Checking with IsNull() is a way I didn't see.

But why did Benoit implement val() this way? I don't see any sense in 
it, but there might be one (I'm not a professional programmer after all).

Rolf


Rob schrieb:
> 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
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 





More information about the User mailing list