Skip to main content

Integer Division ( \ )

Produces the integer result of the division of the operands, after interpreting both operands as numbers.

Details

The Integer Division operator produces the integer result of the division of the left operand by the right operand. It does not return a remainder, and does not round up the result.

Examples

The following example performs integer division on two integer operands. ObjectScript does not return the fractional portion of the number:

 WRITE "355 \ 113 = ", 355 \ 113 // 3

The following example performs string arithmetic. Integer Division uses any leading numeric characters as the values of the operands and produces an integer result.

 WRITE "8 Apples" \ "3.1 oranges" // 2

If an operand has no leading numeric characters, ObjectScript assumes its value to be zero. If you attempt integer division with a zero-valued divisor, ObjectScript returns a <DIVIDE> error.

FeedbackOpens in a new tab