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 / ba → 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.ProjectCountUsing Division with a Department Collection
Department.allInstances
->collect(d | d.EmployeeCount / d.ProjectCount)Returns the average employees per project for each department.
