OCL Precedence rules

The precedence order for the operations, starting with 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 current OCL standard. In standard OCL, “and”, “or,”, “xor” and “implies” has lower precedence than “<“, “>”, “<=”, “>=”, “=”, “<>”

This page was edited 92 days ago on 06/19/2024. What links here