decoding someone elses code what is this?

What does this ">>" mean? As in...

first_payment_in_series_date >> 3

I have never used this nor have i seen it before.

But you *do* know Ruby has documentation, right? :slight_smile:

means bit shift

eg

8 >> 3 means shift value by 3 bits to the right .. result is 1 (8 = 1000b, after shift is 0001b = 1)

opposite is << …

1 << 3 = 8

tom

ps: in asm it is shl or shr

Yes i found it sorry for the trouble. There is so much crap in the code
I'm looking at I am having a hard time telling what is what. this can be
deleted!

means bit shift

eg

8 >> 3 means shift value by 3 bits to the right .. result is 1 (8 = 1000b, after shift is 0001b = 1)

opposite is << …

1 << 3 = 8

tom

ps: in asm it is shl or shr

If first_payment_in_series_date was an Integer, then that might be the case, but I'd suspect that a Date is much more likely with that name.

Look for the documentation for Date#>>

-Rob

(posted so future readers will not be lead too far astray)

>> means bit shift

eg

8 >> 3 means shift value by 3 bits to the right .. result is 1 (8 = 1000b, after shift is 0001b = 1)

opposite is << …

1 << 3 = 8

Of course, being ruby it can mean different things on different
objects. For Date objects for example >> 3 advances the date by 3
months (and << moves in the other direction)

Fred

nate hunter wrote in post #1018531:

What does this ">>" mean? As in...

first_payment_in_series_date >> 3

I have never used this nor have i seen it before.

The first thing you should do is try to determine the type of the thing
calling the method. The method is '>>' and the thing calling the method
is on the left. Because the programmer used good variable names, it
makes it easy to determine what type the left side is.

means bit shift

eg

8 >> 3 means shift value by 3 bits to the right .. result is 1 (8 = 1000b, after shift is 0001b = 1)

opposite is << …

1 << 3 = 8

tom

ps: in asm it is shl or shr

If first_payment_in_series_date was an Integer, then that might be the case, but I'd suspect that a Date is much more likely with that name.

Look for the documentation for Date#>>

-Rob

(posted so future readers will not be lead too far astray)

you're right. When date, it moves by months, I've overlooked the _date in variable name

tom