Skip to main content

Number Remainder

rascal-0.34.0

Synopsis

Remainder of two integer values.

Syntax

Exp₁ % Exp₂

Types

Exp₁Exp₂Exp₁ % Exp₂
intintint

Description

Yields the remainder when dividing the of Exp₁ by the value of Exp₂.

Examples

rascal>12 % 5
int: 2
rascal>12 % 6
int: 0

Pitfalls

Remainder is only defined on integers:

rascal>13.5 % 6
|prompt:///|(7,1,<1,7>,<1,8>): remainder not supported on real and int
Advice: |https://www.rascal-mpl.org/docs/Rascal/Errors/CompileTimeErrors/UnsupportedOperation|
ok