OCL Precedence rules
No edit summary
(Adding message template to the top of the page)
Line 1: Line 1:
{{message|Write the content here to display this box}}
The precedence order for the operations, starting with the highest precedence, in OCL is:
The precedence order for the operations, starting with the highest precedence, in OCL is:
* dot and arrow operations: <code>“.”</code> and <code>“->”</code>  
* dot and arrow operations: <code>“.”</code> and <code>“->”</code>  

Revision as of 22:10, 16 June 2024

This page was created by Lars.olofsson@mdriven.net on 2023-05-03. Last edited by Edgar on 2025-01-20.

Write the content here to display this box

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 “<>”