Numeric Operators

Numeric Operators

Numeric Operators

+ (Addition)

The addition operator adds the operands to produce the numerical sum. It is an error if either operand is not a number.

Example

5 + 2 => 7

- (Subtraction/Negation)

The subtraction operator subtracts the RHS value from the LHS value to produce the numerical difference It is an error if either operand is not a number.

It can also be used in its unary form to negate a number

Examples

  • 5 - 2 => 3
  • - 42 => -42

* (Multiplication)

The multiplication operator multiplies the operands to produce the numerical product. It is an error if either operand is not a number.

Example

5 * 2 => 10

/ (Division)

The division operator divides the RHS into the LHS to produce the numerical quotient. It is an error if either operand is not a number.

Example

5 / 2 => 2.5

% (Modulo)

The modulo operator divides the RHS into the LHS using whole number division to produce a whole number quotient and a remainder. This operator returns the remainder. It is an error if either operand is not a number.

Example

5 % 2 => 1

.. (Range)

The sequence generation operator is used to create an array of monotonically increasing integer start with the number on the LHS and ending with the number on the RHS. It is an error if either operand does not evaluate to an integer. The sequence generator can only be used within an array constructor [].

Examples

  • [1..5] => [1, 2, 3, 4, 5]
  • [1..3, 7..9] => [1, 2, 3, 7, 8, 9]
  • [1..$count(Items)].("Item " & $) => ["Item 1","Item 2","Item 3"]
  • [1..5].($*$) => [1, 4, 9, 16, 25]

    • Related Articles

    • Path Operators

      Path Operators Fuuz Context Where this applies in Fuuz: Path operators drive how Fuuz Pipelines traverse inbound payloads and build outbound messages. They are central to mapping data from PLC/MES/ERP sources into normalized objects before publishing ...
    • Comparison Operators

      Comparison Operators = (Equals) The equality operator returns Boolean true if both operands are the same (type and value). Arrays and objects are checked for deep equality. Arrays must have the same values in the same order. Objects must have the ...
    • Numeric Functions

      Numeric functions $number() Signature: $number(arg) Casts the arg parameter to a number using the following casting rules - Numbers are unchanged - Strings that contain a sequence of characters that represent a legal JSON number are converted to that ...
    • Boolean Operators

      Boolean Operators and (Boolean AND) The 'and' operator returns Boolean true if both operands evaluate to true. If either or both operands is not a Boolean type, then they are first cast to a Boolean using the rules of the $boolean function. Example ...
    • Other Operators

      Other Operators Fuuz Context Where this applies in Fuuz: These operators are frequently used in Fuuz Mappings and Rules to craft strings, bind variables, chain functions, and define transforms that keep payloads consistent across steps. Concatenation ...