if counter % 2 == 1
I am trying to decode this line - it\'s a Rails project and I am trying to figure out what the %
does in this if statement.
It is the modulo operator, which is a fancy way of saying it's the remainder operator.
So if you divided a number by two, and the integer remainder of that number is one, then you know the number was odd. Your example checks for odd numbers.
Often this is done to highlight odd number rows with a different background color, making it easier to read large lists of data.