Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking variables value sequence
Message
From
21/01/2008 07:36:47
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01283482
Message ID:
01283568
Views:
8
>Yes, I tried this combinations before but, in the example below:
>
>1, 8, 3, 4
>
>The messagebox "price 3 is incorrect will be displayed"
>It looks like price 3 is incorrect because 3 is less then 8, but price 2 is really incorrect
>
>So this kind of code does not work
>
>Any other idea ?
>
>Moises

It is really a matter of definition, which price is correct. The user can either lower price 2, or increase prices 3 and 4.

Here is another example:

1, 3, 7, 6

How should your program know where the user made a mistake, and whether the third price should be lower, or the fourth price higher?

Perhaps you better just have the user check:
if not (price1 < price2 and price2 < price3 and price3 < price4)
  MessageBox("Please put the prices in increasing order.")
endif
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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform