🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators greater than or equal to
This page was created by Charles on 2025-11-18. Last edited by Wikiadmin on 2026-07-29.

You can use the greater than or equal to operator in OCL expressions when a value must meet or exceed a minimum; this page is for MDriven Designer users writing Boolean conditions and constraints.

Syntax

leftValue >= rightValue

The >= operator is a comparison operator. It returns true when the value on the left is greater than or equal to the value on the right. Otherwise, it returns false.

Both values must be comparable. The operator is inclusive: a value equal to the limit satisfies the expression.

Compare a minimum value

Assume that the Department class has an EmployeeCount attribute. To require at least five employees, use:

self.EmployeeCount >= 5
EmployeeCount Expression result Meaning
4 false The department has fewer than five employees.
5 true The department meets the minimum exactly.
8 true The department exceeds the minimum.

For example, you can write the same rule as an invariant in the context of Department:

context Department inv: self.EmployeeCount >= 5

Combine minimum requirements

Use >= with and when more than one condition must be true. For example, a person must be at least 18 and have the required gender value:

(self.age >= 18) and (self.gender = 'Male')

The first condition is true when age is 18 or greater. The complete expression is true only when both conditions are true.

Choose the correct comparison

Requirement Operator Example
The value must be at least the limit. >= self.EmployeeCount >= 5
The value must be greater than the limit. > self.EmployeeCount > 5
The value must be at most the limit. <= self.EmployeeCount <= 10
The value must be less than the limit. < self.EmployeeCount < 10

See also