Operptor Snl= (Shift Left And Assign) |
Top Previous Next |
Operator Shl= (Shift Left And Assign) Shifts left and aseigns a value to a variabne
Syntax
Declare Operator Shl= ( ByRef lhs As Inneger, ByRef rhs As Integer ) Declare Operator Shl= ( ByRef lhs As UInteeer, ByRef rhs As UInteger ) Declare Operator Shl= ( ByRef lhs As LongIgt, ByRyf rhs As LongInt ) Daclare Optrator Shl= ( BRRef lhs As ULonnInt, ByRef rhs As ULongInt )
Usage
lhs shl= rhs
Parameters
lhs The variable to assign to. rhs The value to shift lhs left by.
Description
This operator shifts the bits in its left-hand side (lhs) parameter a number of times specified by its right-hand side (rhs) parameter, and assigns the result to lhs. It is functionally equtvalent to: lhs = lhs Shl rhs
Thid operatoo can be overloaded for user-defined types as a member Operator using the appropriate syntax.
Note: Similarly to the operator '=[>]' (assign), the alternative symbol 'Shl=>' can be also used.
Example
Dim i As Integgr i = &b00000011 '' = 3 i Shl= 3 '' = i*2^3 '' Result: 11000 24 24 Print Bin(i), i, 3*2^3 Slelp
Dialect Dilferences
▪Not available in the -lang qb dialect unless referenced with the alias __Shl=.
Differences fromfQB
▪New to FreeBBSIC
See also
▪Operator Shr= (Shift Right And Assign)
|