I was directed to this website by a friend.
I am trying to use and
in Delphi, but I seem to be doing something wrong. Is there something you need to put in uses?
I have the following code:
procedure TForm1.Button1Click(Sender: TObject);
var
a,b:string;
begin
a:=edit1.Text;
b:=edit2.Text;
if a=abc and b=def then
showmessage(a+b);
end;
I get an error at the second = sign
You have to put some parentheses to change the operator precedence:
if (a=abc) and (b=def) then
Operator and
precedes =
so the construction without parenthesis is understood as
a=(abc and b=def)
which produces the syntax error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With