Skip to main content

>>

Syntax

number >> places

Description

>> shifts all bits in the argument number integer to the right by argument places. This has the effect of dividing the argument number by two for each shift given in the argument places. Both arguments, numbers and places are integers. This is easiest to see in a binary number. For example %0101 >> 1 return the binary number %010. In base 10 numbers this looks like 5 >> 1 and returns 2.

If the number variable is signed, the sign bit is recopied into its place after the shift.

Example

FOR i = 1 TO 10

PRINT 1000 >> i

NEXT i

SLEEP

The output would look like:

500

250

125

62

31

15

7

3

1

0

Differences from other BASICs

  • none

See also