>>>Does Foxpro exaluate all ANDs before any ORs in a conditional statement, or does it evaluate them in order?
>>>
>>>How would VFP evaluate the following IF statement?
>>>
>>>c1 = "1"
>>>c2 = "X"
>>>c3 = "X"
>>>
>>>IF c1 = "1" or c2 = "2" and c3 = "3"
>>>
>>>Would it evaluate the previous IF statement to be like the first or second IF statement below?
>>>
>>>if (c1 = "1" or c2 = "2") and c3 = "3" && evaluates to .f.
>>>if c1 = "1" or (c2 = "2" and c3 = "3") && evaluates to .t.
>>>
>>>Thanks - Brenda
>>
>>
>> It evaluates like your second example. (.T.) But actually it only does the first part. The other two parts are not actually evaluated. You can see this by trying this:
>>
>>if c1() or c2() and c3()
>>endif
>>
>>function c1
>>messagebox('c1')
>>
>>function c2
>>messagebox('c2')
>>
>>function c3
>>messagebox('c3')
>>
>>Only the "c1" message displays.
>
>As a follow up, if you change the c1 function to return .f., then all 3 functions execute. So there is an implied set of parentheses the same as your second example.
Whoops, one more thing. If the c2 function also returns .f., the c3 function does not execute. (With or without actual parentheses around c2 and c3)