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

Jeff Johnson jeffjohnson at ...377...
Thu Jun 23 01:10:54 CEST 2005


Val messed with my mind for awile. all other Basic's, Fox Pro and dBase have 
used have just return a 0 for the following val(a)  with a being "st" "" 
null, ST123 etc. with Val(a) returning 123 if a equaled 123st.

Takes a little getting used to it.. my brain is programmed differently


On Wednesday 22 June 2005 01:42, Eilert wrote:
> 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
>
> -------------------------------------------------------
> 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