Name

>> (right shift)

Examples
m = 8 >> 3   # In binary: 1000 to 1
print(m)   # Prints "1"
n = 256 >> 6 # In binary: 100000000 to 100
print(n)   # Prints "4"
o = 16 >> 3  # In binary: 10000 to 10
print(o)   # Prints "2"
p = 26 >> 1  # In binary: 11010 to 1101
print(p)   # Prints "13"
# Using "right shift" as a faster technique than red(), green(), and blue()
argb = color(204, 204, 51, 255)
a = (argb >> 24) & 0xFF
r = (argb >> 16) & 0xFF  # Faster way of getting red(argb)
g = (argb >> 8) & 0xFF   # Faster way of getting green(argb)
b = argb & 0xFF          # Faster way of getting blue(argb)
fill(r, g, b, a)
rect(30, 20, 55, 55)
Description
Syntax
value >> n
Parameters
value
n
Related << (left shift)
Updated on Wed Jan 18 17:32:21 2017.
Creative Commons License