Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Syntax for IF STATEMENTS
Message
De
04/02/2003 21:26:18
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
 
 
À
04/02/2003 21:00:05
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00749162
Message ID:
00749197
Vues:
24
Thank you for that quick lesson Hilmar. Appreciate it.


>>Hi Hilmar:
>>
>>>You already are using IF statements. What is it you want to accomplish? Reduce the code? Use a single nested IIF()?
>>>
>>Thank you for your response. I was having trouble with using the word AND in each of the statements. VFP did not like that, therefore unsure whether and can be used at all in an IF statement.
>
>Ah, I see now.
>
>
>if age => 55 and < 65
>
>
>Sergey already gave you a cleaner version of your code, I will now explain, for future reference, the correct syntax you were looking for.
>
>You are confusing with other programming languages, or systems like Excel, who permit this syntax.
>
>The problem here is that each side of the AND statement has to be a valid statement. The left part, age => 55 is valid, although it is more customary to write this as age >= 55. The right side, < 65 is not valid - what are you comparing 65 with? I know what you mean, but VFP doesn't understand this.
>
>The correct version is as follows:
>
>
>if age >= 55 and age < 65
>
>
>An expression like age >= 55 and age < = 65 can be simplified as between(age, 55, 65), but no equivalent simplification exists if one side uses greater-or-equal, and the other side only less-than, for instance.
>
>HTH, Hilmar.
- Ravi

True greatness consists in being great in little things.
- Charles Simmons
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform