
True or False or False = False!
(True or False or False) = True.
function TPSDConnectionMonitor.IsOnline: Boolean;
var
cState: TPSDConnectionState;
begin
Result := (Not OfflineStoreEnabled) or (Not Enabled) or IsOnline(cState);
end;
See the picture.
FOfflineStoreEnabled = False
FEnabled = True
IsOnline(cState) does an and between two states and returns False
The expression
(Not OfflineStoreEnabled) or (Not Enabled) or IsOnline(cState)
is (True) or (False) or False
and Result is False! #WTF
Add extra paranthesis to the expression
( (Not OfflineStoreEnabled) or (Not Enabled) or IsOnline(cState))
is ((True) or (False) or False)
and Result is True as expected!
Can someone make sense of this?
You must be logged in to post a comment.