Solved

How to check value between x and y?

Posted on 1998-07-06
5
137 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?
0
Comment
Question by:Guiseppe
  • 3
5 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 20 total points
ID: 1357147

 var i : integer;

begin
 if (i<40) or (i> 50) then begin
 end;
end;
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1357148
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.
0
 
LVL 3

Expert Comment

by:vladika
ID: 1357149
Between?????

May be

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

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1357150
Oops, vladika you're right. If 40 and 50 have to included, you need to use >= and <=.
0
 

Author Comment

by:Guiseppe
ID: 1357151
Well, OK. It was just a matter of placing brackets the right way.
Thanks for your help, folks.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Comparing dates in Delphi. Greater than/ Less than 3 210
Working with hours 3 64
how to update exe applicatio from internet ? 6 86
Convert MS Word document to a PDF file 9 90
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question