🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
OCLOperators not equal to
This page was created by Charles on 2025-11-18. Last edited by Restore-user on 2026-10-21.

Symbol (<>)

The <> operator is a comparison operator used to check whether two values are not equal. It returns a Boolean result (true or false) and is commonly used in OCL constraints and validation rules.

Assume the Department class has an attribute called DepartmentName.

Department.allInstances->forAll(d | d.DepartmentName <> 'Projects')

Results:

Error creating thumbnail: File missing







What this means
  • The expression returns true only if every Department has a name different from Projects.
  • If even one Department has the name Projects, the result is false.