[Gambas-user] iif bug?

Oliver Etchebarne Bejarano drmad at ...1302...
Thu Apr 27 01:23:18 CEST 2006


Hey folks,

I'm trying this:

------

dim id as integer
dim text as string

text = "1"
id = iif(IsNull(Val(text)), 0, Val(text))

------

Obviously, I want to obtain the numeric value of "text", or 0 if it is 
not a valid number. But that code fails with

ERROR: Type mismatch: wanted Integer, got Null instead.

It looks like Gambas is evaluating both true and false parts before
doing the iif check, and I think that shouldn't be the correct behavior.

btw I'm trying this on gambas 1.9.29

HTH

-- 
Oliver Etchebarne Bejarano
drmad/paperclip
www.paperclip.com.pe




More information about the User mailing list