Add an if with 2 conditions

Asked

Viewed 2,941 times

4

I have the following variables declared:

n_var:= strtoint (En_var.Text);
n_raster := strtoint (En_raster.Text);

And I would like you to make a condition by comparing their values for example:

if (En_var.Text = (inttostr(3)) and (En_raster.text = (inttostr(1))))  then

but I get the following error message:

[dcc32 Error] Comments.pas(117): E2010 Incompatible types: 'string' and 'Boolean'

If I do it normally without the AND it works, example:

if (En_var.Text = (inttostr(3)))  then

What’s the cause of it?

1 answer

6


There was one left ) in his comparison:

change your code for this:

if (En_var.Text = inttostr(3)) and  (En_raster.text = inttostr(1)) then
  • Perfect, same observation error. Can tell me why of str and Boolean conversion error?

  • For we may say that the compiler was "lost" in executing his instruction. And he ended up comparing his En_var.Text which is a string with the condition after and which was returning a Boolean. I am happy to help you. If you can put as best answer I thank you.

  • Sure, I’m on a clock. Thanks for the help.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.