Topic: True and True = TRUE... False and False = ???

Is the result standard to delphi or im doing it wrong?

    bolcon1 := False;
    bolcon2 := False;

    if bolcon1 = True and bolcon2 = True then showmessage('both True');
    if bolcon1 = False and bolcon2 = False then showmessage('both false');

what do you think will show up in the message?

both false, right?
wrong..

if both value change to True what will show?
both true only right? wrong again...

Re: True and True = TRUE... False and False = ???

Hello Rhyacm,
Try testing your conditions this way (see attached).
Regards,
Derek.

Post's attachments

Attachment icon bolcon.zip 335.6 kb, 333 downloads since 2019-03-12 

Re: True and True = TRUE... False and False = ???

derek wrote:

Hello Rhyacm,
Try testing your conditions this way (see attached).
Regards,
Derek.

Thank you again derek. so i cant use directly variables with this condition. because i use several statement with AND, now i know why they dont work.
I have to adjust to your method then. thanks!

Re: True and True = TRUE... False and False = ???

You should use brackets

    if (bolcon1 = True) and (bolcon2 = True) then showmessage('both True');
    if (bolcon1 = False) and (bolcon2 = False) then showmessage('both false');

or

    if (bolcon1) and (bolcon2) then showmessage('both True');
    if (not bolcon1) and (not bolcon2) then showmessage('both false');
Dmitry.

Re: True and True = TRUE... False and False = ???

It should work with variables in the same way - I just used checkboxes on the form because it's easier for testing.
Derek