Or-Operator not recognized?

While using the TMSScripter I stumbled upon a strange problem with the Or-operator.

When I Execute the script the Or-operator doesn’t seem to work correctly. I started to debug this a little and noticed that within the scripting engine there is never an Or-function triggered in the virtual machine (The And-function is called properly).

In the image you can see my script and the output.

Is this an issue due to a wrong setup or is this a known problem?

All variables in scripter are variants, so there isn't a strong distinction between booleans and integers. Operators like or and and are considered as boolean operators, thus a 0 value means false, and any other value means true.

When you do a "4 or 9" operation, scripter is considering you are doing a boolean operation. Since 4 is already true (non-zero), it performs a short boolean evaluation and doesn't even evaluate the rest of the expression, return just 4 (true). To avoid that you can disable ShortBooleanEval:

  IDEScripter1.ShortBooleanEval := False;

Good to know. Thank you very much, it solved my problem :).