if() Function

if(expressionL, expression1, expression2) uses a logical expression to decide whether to return expression1 or expression2. For example, a user-defined screen might have a numeric field that needs to be validated as always greater than zero. In the field properties, the valid expression might be: if(Value > 0, .T., ErrBeep("Enter a value greater than 0.") This if() expression returns .T. if the field's value is greater than zero (allowing the user to tab to another field). But if the value is 0 or negative, the second expression is evaluated instead. This takes advantage of the fact that the ErrBeep() function always returns .F. after popping up the enclosed message. When .F. is returned by a valid expression, the user is not allowed to exit the field.