πŸš€ Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCL Precedence rules
This page was created by Lars.olofsson on 2023-05-03. Last edited by Edgar on 2025-08-31.


The precedence order for the operations, starting with the highest precedence, in OCL is:

  • dot and arrow operations: β€œ.” and β€œ->”
  • unary β€œnot” and unary minus
  • β€œ*” and β€œ/”
  • β€œ+” and binary β€œ-”
  • β€œif-then-else-endif”
  • β€œand”, β€œor”, and β€œxor”
  • β€œimplies”
  • β€œ<β€œ, β€œ>”, β€œ<=”, β€œ>=”
  • β€œ=”, β€œ<>”

Parentheses β€œ(β€œ and β€œ)” can be used to change precedence.

Note! This is not exactly according to the current OCL standard. In standard OCL, β€œand”, β€œor”, β€œxor” and β€œimplies” have lower precedence than β€œ<β€œ, β€œ>”, β€œ<=”, β€œ>=”, β€œ=”, and β€œ<>”