🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators modulus
This page was created by Charles on 2025-11-18. Last edited by 62.169.16.147 on 2026-09-12.

Symbol (%)[edit source]

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 b

Example: Using the Department Class with an EmployeeCount attribute

self.EmployeeCount mod 2 = 0

This returns true if the employee count is even


Using Modulus with a Department Collection

Department.allInstances
  ->select(d | d.EmployeeCount mod 2 = 1)

Results:

Error creating thumbnail: File missing