Am 19.09.17 um 21:27 schrieb Wolfgang Lenerz via Ql-Users

As a=0 at line 30, there is an "ERROR IN EXPRESSION" in the "if" condition
And there is no way to put this expression to "true" or "false" as there is a 
big BIG "ERROR" !!!

> Hi all,
> 
> Just a rant about the SBasic AND operator.
> 
> Suppose this:
> 
> 10 a=0
> 20 b=10
> 30 if (a<>0 AND b/a=5)
> 40   do_something
> 50 end if
> 
> Run it and what happens?
> 
> You get an "overflow" error at line 30.
> You get this error because it is trying to evaluate the second condition 
> (b/a) and failing as a=0 and you can't divide by 0.
> 
> BUT WHY IS IT TRYING TO EVALUATE THE SECOND CONDITION IN THE FIRST PLACE?

Because there is no order for evaluating the first and the second condition in 
the AND operation,
In any way both have to be without any errors.

FALSE AND ERROR is FALSE ? That cannot be !
FALSE AND ERROR has to be ERROR !!!

> The first condition (a<>0) is NOT met and so, in any other programming 
> language I use, the second condition isn't even tested, as the result 
> will be "false" anyway because of this.

So you will ever get big BIG ERRORs...

> Apparently though, Sbasic still also tests the second condition.
> 
> Grrrr.
> 
> Wolfgang
> 
> 
> 
SBASIC is better ;-))
> 
> 
> _______________________________________________
> QL-Users Mailing List
_______________________________________________
QL-Users Mailing List

Reply via email to