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

Symbol (:=)

In standard OCL, there is no assignment operator like = in programming languages (C#, Java, etc.). OCL is a declarative, side-effect-free language, meaning it does not change values—it only describes constraints and expressions.

However, in MDriven / Executable OCL, assignment-like behavior is supported using special assignment operators.

Example:

Using the Department class

self.Name := 'Finance'

It assigns the value "Finance" to the department’s Name. Used in actions, state transitions, and rules It can also be used in arithmetic to assign values

self.EmployeeCount := self.PermanentStaff + self.ContractStaff

This calculates and assigns the total number of employees. Assignment with Collections

self.Employees := self.Employees->including(newEmployee)