🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators divide
Created by Charles on 2025-11-18 · Last edited by Colline.ssali on 2026-01-23.

Symbol (/)

In OCL, the divide operator (/) is an arithmetic operator used to divide one numeric value by another. It is commonly used in calculations, derived attributes, and constraints. The result is typically of type Real, even when both operands are integers.

Basic Syntax

a / b

a → dividend

b → divisor

Example:

Using the Department Class

Assume the Department class has:

EmployeeCount : Integer

ProjectCount : Integer

Calculate Average Employees per Project

self.EmployeeCount / self.ProjectCount

Using Division with a Department Collection

Department.allInstances
  ->collect(d | d.EmployeeCount / d.ProjectCount)

Returns the average employees per project for each department.