Div= Operator

Divides the value of a variable by the value of an expression, then changes the variable to the result, if the expression is not zero. If the expression is zero, the variable becomes zero.

Syntax

variable Div= expression

Parts

variable
A numeric variable or property.
expression
A numeric expression.

Instructions

The two statements that follow operate the same.

variable Div= expression
variable = variable Div expression

The element on the left side of Div= can be a scalar variable, a property, or an element of an array. If it is a property, it cannot have the modifier @ReadOnly.

Div= divides the variable or property on its left side by the value on its right side to get a quotient. If the value of the right side is not zero, it changes the variable or property on its left side to the quotient. But if the value on the right side is zero, it changes the variable to zero.

Div= is an alternative to /=. /= can cause an exception for some values. But you can use Div= where you can safely ignore the result of division by zero.

Data types

TODO

Examples

x = 84
x Div= 2
y = x
y Div= 0
After run
variablevalue
x42
y0

See also