# Modulo (#)

Produces the value of an arithmetic modulo operation on two operands, after interpreting both operands as numbers.

## Details

The Modulo operator produces the value of an arithmetic modulo operation on two numerically interpreted operands. When the two operands are positive, then the modulo operation is the remainder of the left operand integer divided by the right operand.

## Examples

The following examples perform modulo operations on numeric literals, returning the remainder:

`````` WRITE "37 # 10 = ",37 # 10,! // 7
WRITE "12.5 # 3.2 = ",12.5 # 3.2,! // 2.9
``````

The following example performs string arithmetic. When operating on strings, they are converted to numeric values (according the values described in Variable Typing and Conversion) before the modulo operator is applied. Hence, the following two expressions are equivalent:

`````` WRITE "8 apples" # "3 oranges",!  // 2
WRITE 8 # 3 // 2``````

Because InterSystems IRIS® evaluates a string with no leading numeric characters to zero, a right operand of this kind yields a <DIVIDE> error.

FeedbackOpens in a new tab