[Gambas-user] Bad logic on my part

Me adamnt42 at gmail.com
Thu Aug 16 14:06:16 CEST 2018


On Thu, 16 Aug 2018 08:26:03 +0200
Rolf-Werner Eilert <rwe-sse at osnanet.de> wrote:

> 
> If (TypeOf(Data[13]) = gb.Integer) And If (Data[13] > 3) Then...

Ah that works!
Damned if I know why though.

> If TypeOf(Data[13]) = gb.Integer And Data[13] > 3 Then...
As far as I recall, the second If means that each condition is evaluated seperately, so if Data[13] is a string the second condition fails and so the whole construct fails with a "Expected integer - Got string" (whatever) error.

But thanks for the first. I was looking at it for some time and could not see what the heck was wrong.

b
-- 
Me <adamnt42 at gmail.com>


More information about the User mailing list