Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Easy one But I forgot. If n = 0, or n = 1
Message
From
10/06/2013 22:05:17
 
 
To
10/06/2013 21:04:43
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01575918
Message ID:
01575970
Views:
61
Between is fine if you actually want a range, but if you want to match the exact values the you want Inlist instead.
If InList(n, 1, 2, 3) Then
   ...
EndIf
In the case of the example, the one you'd choose would depend on whether you are happy matching a range, in which case in Between, or an exact list of values, in which case you'd use InList.

Ian Simcock.


>(pointing out the obvious) This of course using BETWEEN makes the assumption that the expression can be expressed as a contiguous range of values (i.e. you don't need to exclude values within the range). It's OK as long as the question can indeed be expressed as "if X is between A and Z then ..", rather than being more of "if X is A, B, C or D then ..." (w/ potential for adding conditions T, X, and Y).
>>>
>>>by something shorter. I thought it would be something like if n in(1,2,3)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform