Solved

How to check value between x and y?

Posted on 1998-07-06
5
138 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…

749 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