[Gambas-user] Val function changed behaviour, porting gambas2 to gambas3

Rolf-Werner Eilert eilert-sprachen at ...221...
Thu Nov 3 08:30:51 CET 2016


Am 02.11.2016 17:16, schrieb Benoît Minisini:
> Le 02/11/2016 à 16:49, Rolf-Werner Eilert a écrit :
>> The new behaviour of val() drove me nuts when it appeared first ;) I had
>> used it in so many places, and all over my code. Sometimes it lasts for
>> weeks until your program hits this place, and AGAIN val() Arrgh... :)
>>
>> So in most cases, I ended up either checking for null before (somewhat
>> roundabout) or just using CInt() instead.
>>
>> Regards
>> Rolf
>>
> This change was needed, because Val() now takes thousand separators into
> account, and some language uses spaces for that.
>
> Regards,
>

No problem, Benoit, I see the advantages. After all, my problem was due 
to sloppy programming... ;)

But in BASIC, one is used to everything being converted from one format 
to another without raising an error that can stop the program. So in 
normal BASIC thinking, if val() cannot find a value in a string, it 
would be expected to send "0", though it isn't fully logical I have to 
admit. In the scope of my programming, this would do the job. Maybe I 
should make my own Val()...

Regards
Rolf





More information about the User mailing list