bitwise left shift
Summary
Left shifts the bits of an expression.
Syntax
result = expression1 << expression2
- result
- Any variable.
- expression1
- Any expression.
- expression2
- Any expression.
Examples
The << operator shifts the bits of expression1 left by the number of bits specified in expression2. For example, the variable temp has a value of 56 because 14 (00001110 in binary) shifted left two bits equals 56 (00111000 in binary).
var temp
temp = 14 << 2
See also
Other articles
- Left Shift Assignment Operator (<<=)
- Bitwise Right Shift Operator (>>)
- Unsigned Right Shift Operator (>>>)
Attributions
Microsoft Developer Network: Article