Bug? Try catch bug in B4A 4.0?

Sonny

Member
Licensed User
Longtime User
Erel,

The following code does not work properly:



Dim firstVar As Double
Dim secondVar As Double
Dim result As Double

firstVar = 0
secondVar = 0

Try
result = firstVar / secondVar
Catch
result = 0
End Try



According to the semantics of the Try/Catch command in B4A, I should get a "0" in the variable result - instead I'm getting "NaN" - which is incorrect.

Please advise.

> Sonny <
 

Sonny

Member
Licensed User
Longtime User
No error is raised in this case. Add a Log message to see it.
So "NaN" is not an error? Isn't any divide by zero condition supposed to throw a math exception? After all, B4A is based on Java and NOT JavaScript, right - or am I missing something here? Please enlighten me.
 
Top