Wednesday, January 6, 2010

How VFP evaluate expressions

When a conditional statement has more than one expression, VFP evaluates them one at a time from left to right. As soon as VFP can evaluate the expression, it stops, even if it does not evaluate all conditions.

When defining conditional expressions, define the evaluation order so as to minimize the work that Visual FoxPro must do. Put the most critical condition first. This action saves VFP time; it also enables you to include in the second part of the test conditions that are not otherwise valid.

When you are connecting two expressions with OR, put the one that is most likely to pass first. When you are connecting two expressions with AND, put the one that is most likely to fail first.

Source:
www.webbasedprogramming.com/Special-Edition-Using-Visual-FoxPro-6/ch04/ch04.htm

No comments:

Post a Comment