We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How to check value between x and y?

Guiseppe
Guiseppe asked
on
Medium Priority
150 Views
Last Modified: 2010-07-27
I want to check for a certain value, lets say between 40 and 50. In VB I would write something like this:

i = integer

if i < 40 or i > 50 then ...

How can I do this in Delphi?
Comment
Watch Question

Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Commented:
Sorry, to quick, the total answer ;-) should look like :

Hi Guiseppe,

 var i : integer;

begin
 if (i<40) or (i> 50) then begin
  {write code here}
 end;
end;

need to know more? Just ask!

Zif.

Commented:
Between?????

May be

if (I>=40) and (I<=50) then

Commented:
Oops, vladika you're right. If 40 and 50 have to included, you need to use >= and <=.

Author

Commented:
Well, OK. It was just a matter of placing brackets the right way.
Thanks for your help, folks.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.