[proFit-list] Operand evaluation in 6.2.2
Luis Sisamon
luis.sisamon at gmail.com
Thu Apr 5 14:56:42 CDT 2012
Hi there, I have noticed a quite weird thing going on with the order of
operand evaluations for logical conditions in 6.2.2
When I run this simple program
program test_boolean;
var i, j : integer;
begin
i := 0;
j := 0;
if i = 1 then
writeln('i equals 1 ', i)
else
writeln('i equals 0 ', i);
if j = 1 then
writeln('j equals 1 ', j)
else
writeln('j equals 0 ', j);
if i=1 and j =1 then
writeln ('both i and j equal 1 ', i, j)
else
writeln ('no they dont ', i, j);
if (i=1) and (j =1) then
writeln ('both i and j equal 1 ', i, j)
else
writeln ('no they dont ', i, j);
End;
I get the following results:
i equals 0 0.0000
j equals 0 0.0000
both i and j equal 1 0.0000 0.0000
no they dont 0.0000 0.0000
You just need to force proper evaluation using parenthesis but i thought
better to comment on this incase someone is pulling his or her hair with.
I di dont check if it works properly in .2.7
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://quantum-soft.com/pipermail/profit-list_quantum-soft.com/attachments/20120405/8b60ff9f/attachment.html>
More information about the proFit-list
mailing list