Operators

Expressions are made more powerful with the use of operators. Calculated Fields for ACF supports two different classes of operators, arithmetic and conditional.

Arithmetic operators #

The arithmetic operators corresponds to the basic math operators you’re probably already very familiar with:

OperatorNameDescription
+AdditionReturns the sum of two numbers
SubtractionReturns the difference between two numbers
*MultiplicationReturns the product of two numbers
/DivisionReturns the Quotient of two numbers

Conditional operators #

An expression can also contain an expression using a conditional operator. Conditional operators will return either 1 or 0 representing true or false. The supported conditional operators are

OperatorNameDescription
==EqualsReturns 1 when two values are equal, 0 otherwise
!=Not equalsReturns 1 when two values are not equal, 0 otherwise
>Greater thanReturns 1 when the first operand is greater than the second, 0 otherwise
<Less thanReturns 1 when the first operand is lower than the second, 0 otherwise
>=Greater than or equalReturns 1 when the first operand is greater than or equal to the second, 0 otherwise
<=Less than or equalReturns 1 when the first operand is less than or equal to the second, 0 otherwise

Powered by BetterDocs

Leave a Reply

Your email address will not be published. Required fields are marked *