🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators div
This page was created by Stephanie on 2025-01-08. Last edited by Wikiadmin on 2026-07-29.

You use div in OCL expressions when you need the integer quotient of one Integer value divided by another.

Syntax

integerValue.div(divisor)

The formal operator is Integer::div ( i : Integer ) : Integer. Both the value before .div and the argument are Integers, and the result is an Integer.

What it returns

div returns the integer quotient of self divided by its Integer argument.

Expression Result Meaning
10.div(2) 5 10 divided by 2 has an integer quotient of 5.
45.div(20) 2 The expression returns the integer quotient for 45 divided by 20.

Use in a model expression

For example, if Age is an Integer attribute on Customer, the following expression gets the first Customer and calculates the integer quotient of its age divided by 20:

Customer.allInstances->first.Age.div(20)

Use div when the result must be an Integer. Ensure that the value you pass as the divisor is an Integer.

See also