Use parentheses effectively
As a best practice, Guidewire recommends that you always use parentheses to make explicit the operator order of precedence in computational expressions. Otherwise, your computations can be harder to read and more likely to contain mistakes.
In the following example, the two expressions produce the same results, but the first expression uses parentheses to make the standard operator order clear:
value = rate + (limit * 10.5) + (deductible / autoGrade) - 15 // clear order of precedence
value = rate + limit * 10.5 + deductible / autoGrade - 15 // same result, but poor form
In the following example, using parentheses in the second Boolean expression
ensures that it is read
correctly:
a == b or (c == d and e == f) // clear order of precedencea == b or c == d and e == f // same result, but poor form