Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many CASE in a DO CASE ?
Message
De
23/05/2007 10:00:02
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
23/05/2007 09:55:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01227909
Message ID:
01227911
Vues:
19
>What is the limit of CASE in a DO CASE ?

I don't think there is one.

But for practical reasons, please consider the following example:
do case
case x = 1
  ...
case x = 2
  ...
case x = 3
  ...
...
case x = 500
  ...
endcase
If "x" happens to be equal to 500, Visual FoxPro must analize all 500 cases, before carrying out the desired action. If this happens often, i.e., in a tight loop, performance will be bad. It might be much more efficient to split it, for example, as follows:
do case
case x <= 100
  do case
  case x <= 10
    case x = 1
      ...
    case x = 2
      ...
  case x <= 20
    case x = 11
      ...
    case x = 12
      ...
case x <= 200
...
Or something similar. Much less CASEs to be analyzed, for any given number.
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