Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with multiple if condition syntax

Status
Not open for further replies.

CADTenchy

Technical User
Dec 12, 2007
237
GB

Is it possible to make an if..then expression something like this:
Code:
if IntegerValue = [0,2,4..6] then

Where IntegerValue is my integer variable, and I want to execute the then statement if IntegerValue is any of 0,2,4,5 & 6.
It seems like something basic, and I have done this OK:
Code:
if not (Key in [#8, #13, #9, '0'..'9', 'a'..'z', 'A'..'Z']) then


Steve (Delphi 2007 & XP)
 
You specified the answer, you use sets like in the second one:

Code:
if IntegerValue in [0, 2, 4..6] then

is there any message or the like keeping you from doing that?

----------
Those who work hard are rewarded with more work and remembered come time to downsize. Those who hardly work are given a paycheck and ignored completely.
 

Thanks Glenn.
Can I claim this weeks prize for dumbest question?

I mis-interpreted 'in' in my if key in (from web and tweaked) as associated with keying in of keys.

Now I just checked delphibasics, and sure enough under 'in' is an example.
Sorry guys.


Steve (Delphi 2007 & XP)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top