• Updated

Operators specify the type of calculation that you want to perform on the elements of a calculation. InRule includes three different types of calculation operators: arithmetic, comparison, and text.

Type of operators

Arithmetic operators

InRule supports the following arithmetic operators to perform basic mathematical operations such as addition, subtraction, or multiplication:

– (subtraction)

* (multiplication)

/ (division)

\ (integer division)

^ (power)

Comparison operators

You can compare two values with the following operators. When two values are compared by using these operators, the result is a logical value either TRUE or FALSE.

= (equals)

> (greater than)

< (less than)

>= (greater than or equal to)

<= (less than or equal to)

<> (not equal to)

Logical

You can combine logical conditions into larger conditions by using logical operators.

a And b

a Or b

a Xor b

Not(a or b)

Text concatenation operator

Use the ampersand (&) to join, or concatenate, one or more text strings to produce a single piece of text.

Order of operation

If you combine several operators in a single calculation, InRule performs the operations in the order shown in the following list. As a default, InRule evaluates the operators from left to right.

– (Negation)

% (Percent)

^ (Exponentiation)

* and / (Multiplication and division)

+ and – (Addition and subtraction)

& (concatenation)

= < > <= >= <> (Comparison)

Use of parentheses

To change the order of evaluation, enclose in parentheses the part of the calculation to be calculated first.

For example, the following formula produces 11 because InRule calculates multiplication before addition. The calculation multiplies 2 by 3 and then adds 5 to the result.

=5+2*3

In contrast, if you use parentheses to change the syntax, InRule adds 5 and 2 together and then multiplies the result by 3 to produce 21.

=(5+2)*3

0 out of 0 found this helpful

<% if (previousArticle || nextArticle) { %>
<% if (previousArticle) { %>
<% if (previousTitle) { %>

<%= previousTitle %>

<% } %> <%= previousArticle.title %>
<% } %> <% if (nextArticle) { %>
<% if (nextTitle) { %>

<%= nextTitle %>

<% } %> <%= nextArticle.title %>
<% } %>
<% } %>
<% if (items.length > 1) { %>

<% items.forEach(function(item) { %>
1. <%= item.name %> <%= partial('partial-table-of-contents', { items: item.children, partial: partial }) %>
2. <% }); %>
<% } %>
<% if (items.length) { %>
<% items.forEach(function(item) { %>
1. <%= item.name %> <%= partial('partial-table-of-contents', { items: item.children, partial: partial }) %>
2. <% }); %>
<% } %>
<% if (children.length) { %>
<% children.forEach(function(child, index) { %>
<%= child.innerHTML %>
<% }); %>
<% } %>