/= Operator
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

/= Operator

Divides the value of a variable by the value of an expression and assigns the result to the variable.

variable /= expression


Required. Any numeric variable.
Required. Any numeric expression.


This statement assigns a Double to the variable on the left hand side. If Option Strict is On, variable must be a Double. If Option Strict is Off, an implicit conversion will be made and the resultant value assigned to variable, with a possible error at run time. For more information, see Widening and Narrowing Conversions, and Option Strict Statement.


The following example uses the /= operator to divide one Integer variable by a second and assign the quotient to the first variable.

Dim var1 As Integer = 12
Dim var2 As Integer = 3
var1 /= var2   ' The value of var1 is now 4.

See Also

&= Operator | *= Operator | += Operator | -= Operator | / Operator | = Operator | \= Operator | ^= Operator | Assignment Operators | Arithmetic Operators | Operator Precedence in Visual Basic | Operators Listed by Functionality | Assignment Statements

© 2016 Microsoft