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 β<>β