|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|
Performs an arithmetic left shift on the value of a variable and assigns the result back to the variable.
variable <<= amount
- Required. Variable of data type Byte, Short, Integer, or Long.
- Required. Numeric expression of a data type that widens to Integer.
Arithmetic shifts are not circular, which means the bits shifted off one end of the result are not reintroduced at the other end. In an arithmetic left shift, the bits shifted beyond the range of the result data type are discarded, and the bit positions vacated on the right are set to zero.
The following example uses the <<= operator to shift the bit pattern of an Integer variable left by the specified amount and assign the result to the variable.
Dim Var As Integer = 10 ' Variable containing bit pattern to shift. Dim Shift As Integer = 3 ' Amount to shift bit pattern. Var <<= Shift ' The value of Var is now 80.