Page 1 of 1

Partial If with Or

Posted: Thu Aug 19, 2021 9:17 pm
by jacdelad
Hello,
I know that if I write something like

Code: Select all

If 1 And 0 And 1
PureBasic stops after the "0", which makes sense.

But what if I write

Code: Select all

If 1 Or 0
Does it apply for Or, too? I know, that it won't stop, even if the first value is a "0", but would

Code: Select all

If simple Or (ComplexFunction()1 And ComplexFunction2())
be faster than

Code: Select all

If (ComplexFunction()1 And ComplexFunction2()) Or simple
assuming that if simple is often #True and the two complex and time consuming functions aren't called at all?

Re: Partial If with Or

Posted: Thu Aug 19, 2021 10:33 pm
by jacdelad
I'm stupid. I tried:

Code: Select all

If 1 Or MessageRequester("","",0)
  Debug "No Messagebox -> shortened"
Else
  Debug "I'm never shown"
EndIf
...and it answered my question.