I'm having trouble finding the correct syntax for series of and/or conditions within an IF() calculation. how do AND and OR operators group naturally, and do parenthetical groupings parse correctly when Survey123 does calculations?

In other words: would the following result in valid syntax for something like the following:

IF( (A and B) or (C and D), [return x], [else return Y] )

obviously this is simplified, but I'm trying to build a calculate question based on several combined inputs and other calculations.

I think the issue may be the use of sum(). Based on the documentation, sum() expects a repeat, rather than a list of question names.

This worked for me:

if((${tree_3_dom}= 'yes' and ${tree_4_dom} = ${tree_3_dom}) or ${tree_4_dom} > ${tree_cover20} or (${tree_1_cover_calc} + ${tree_2_cover_calc} + ${tree_3_cover_calc} + ${tree_4_cover_calc}) < ${tree_cover50}, 'yes', 'no')