Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Compare to 0 (zero)
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01662504
Message ID:
01662509
Vues:
48
J'aime (1)
>Hi,
>
>I have an expression that compares if a value in a table/cursor field is equal to 0 (zero). The field is of type numeric with two decimals (e.g. 3.44, 0.00, 1.01)
>
>Which syntax is more reliable to use:
>
>cursor.field = 0 or <another expression>
>
>or
>
>cursor.field = 0.00 or <another expression>
>
>
>TIA

Both are correct, it is a matter of taste. In my code when working with decimals (usually fields that represent currencies or percentages) I type 0.00. This way it is more clear in the code that I am not dealing with an Integer and you can see better how many decimals I would expect in my calculations. That helps me then also to realize where rounding may be necessary etc.

So I got used to write for instance:
IF cuTable.Quantity > 0 AND cuTable.UnitPrice > 0.00
ENDIF
Christian Isberner
Software Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform