OCLOperators modulus
Created by Charles on 2025-11-18 · Last edited by Colline.ssali on 2026-01-27.
Symbol (%)
In OCL, the modulus operator (%) is an arithmetic operator used to return the remainder after dividing one integer by another integer. It is especially useful for cyclic logic, grouping, and parity checks (odd/even).
Basic Syntax:
a mod bExample: Using the Department Class with an EmployeeCount attribute
self.EmployeeCount mod 2 = 0This returns true if the employee count is even
Using Modulus with a Department Collection
Department.allInstances
->select(d | d.EmployeeCount mod 2 = 1)Results:
