Shr and Shl Operators

Demonstrates how to multiply and divide by a power of 2 using the shr and shl operators.

'Shr and Shl Operators
'Demonstrates how to multiply and divide using
'the shr and shl operators.
'********************************************************

Dim As Uinteger myInt = 1, i

'Multiply by powers of 2
Print "Shifting left..."
Print "myInt = ";myInt
For i = 1 To 8
    myInt = myInt Shl 1
    Print "myInt = ";myInt
Next
Print
'Divide by powers of 2
Print "Shifting right..."
Print "myInt = ";myInt
For i = 1 To 8
    myInt = myInt Shr 1
    Print "myInt = ";myInt
Next

Sleep
End