I have a class with bunch of attributes (first, second, third, etc.).
I need to go through all "even" attributes (i.e. second, fourth, sixth, etc.) and make some corrections to just those:
report.first = Calculate('1')
report.second = Calculate('2')
report.second *= 0.9 if requireCorrection && report.second > 5
report.third = Calculate('3')
report.fourth = Calculate('4')
report.fourth *= 0.9 if requireCorrection && report.fourth > 5
report.fifth = Calculate('5')
report.sixth = Calculate('6')
report.sixth *= 0.9 if requireCorrection && report.sixth > 5
# etc.
As you can see, I have the exact same code for each "even" attribute, except for the different attribute name. Is there a way to avoid this repetition in the code (I have around 50 attributes in total)?
Calculate?