Developer Documentation Library > Scripting > Expressions > Operators > Logical operators
 
Logical operators
The logical operators are And, Or, Xor, and Not. You use the And, Or, and Xor operators to combine expressions, and Not to negate expressions.
Note that these operators always function as logical operators and not as bitwise operators. For more information, see Bitwise operations.
And operator
Combine expressions with And if you want the combined expression to return True only when both of the expressions return True.
Syntax
expression1 And expression2
Example
gender = {FEMALE} And education = {YES}
This expression selects female respondents who are currently in full-time education (that is, they answered Yes to the education question).
Or operator
Combine expressions with Or if you want the combined expression to return True when either or both of the subexpressions returns True.
Syntax
expression1 Or expression2
Example
gender = {FEMALE} Or education = {YES}
This expression selects all female respondents and all respondents (both male and female) who are currently in full-time education.
Xor operator
Combine expressions with Xor when you want the combined expression to return True when one, but not both, of the subexpressions returns True.
Syntax
expression1 Xor expression2
Example
gender = {FEMALE} Xor education = {YES}
This expression selects all female respondents who are not in full time education, and all male respondents who are in full-time education.
Not operator
Use Not to negate expressions.
Syntax
Not expression
Example
Not (gender = {FEMALE})
This expression selects male respondents and any other respondents who did not select the Female category--for example, because they refused to answer the question.
Parentheses are required around the expression because the NOT operator has precedence over the comparison operators. For more information, see Operator precedence.
See
Operators