Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Easy one But I forgot. If n = 0, or n = 1
Message
De
10/06/2013 22:05:17
 
 
À
10/06/2013 21:04:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01575918
Message ID:
01575970
Vues:
59
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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform