OCLOperators minus
Created by Charles on 2025-11-18 · Last edited by Colline.ssali on 2026-01-27.
Symbol (-)
In OCL, the minus operator (-) is an arithmetic operator used to perform subtraction between two numeric values. It is also used as a unary operator to indicate a negative value. This operator is commonly used in calculations, derived attributes, and constraints.
Basic Syntax
a - bExample:
Assume the Department class has:
Budget : Double
Spent : Double
self.Budget - self.SpentThis calculates how much budget remains
Using Minus with a Department Collection
Department.allInstances
->collect(d | d.Budget - d.Spent)Results:
