Can a whole variable receive a conditional value?

1

I have a situation where something like this happens:

procedure FrmTeste.Teste;
var
   iSinc: LongInt;
const
   ACAO_PROX: LongInt = $0008;
begin
   iSinc := iSinc or ACAO_PROX;
end;

I could not understand which value receives iSinc when entering this function, what actually happens?

    
asked by anonymous 11.10.2017 / 22:33

1 answer

1

This variable will receive a BOOLEANO value, this assignment would be the same as:

if (iSinc or ACAO_PROX) then
  iSinc := True
else
  iSinc := False;

If you convert, the answer will be TRUE or FALSE :

procedure FrmTeste.Teste;
var
   iSinc: LongInt;
const
   ACAO_PROX: LongInt = $0008;
begin
   iSinc := iSinc or ACAO_PROX;
   ShowMessage(BoolToStr(Boolean(iSinc)));
end;
    
11.10.2017 / 22:53