Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
If Then & Do Case Syntax
Message
De
10/11/2004 11:38:42
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00960036
Message ID:
00960050
Vues:
14
For me, the help (under the topic IF...ENDIF) is quite clear. Let me explain about "expressions". From the VFP help:
IF lExpression [THEN]
  Commands
[ELSE
  Commands]
ENDIF

Arguments

lExpression

Specifies the logical expression that is evaluated. ...
Now, a logical expression can be ANYTHING that evaluates either to .T. or to .F. This can include (not sure if the list is exhaustive):

  • The constant, .T. or .F.
  • A variable that contains .T. or .F.
  • A field that contains .T. or .F.
  • A function that returns .T. or .F.
  • The result of a logical operator, such as AND, OR, NOT - this is the case you mentioned
  • The result of the equality comparison, greater-than, etc.

    ... or any combination. For instance, you used both equality comparisons, and the keyword AND.

    So yes, you can combine different conditions with AND, OR, etc.

    >Does VFP7.0 permit multiple conditions for the If/Then & DoCase conditions e.g.,
    >if table1.field1 = 1 and table2.field3 = 4 and form1.bwlst1.value=3
    > then execute
    >endif
    >
    >OR
    >
    >do case
    > case table1.field1 = 1 and table2.field3 = 4 and form1.bwlst1.value=3
    > then execute
    > case 2
    >endcase
    >
    >I can't find any discussion of this in the VFP reference or Hentzen's book.
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Précédent
    Suivant
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform