CSK Vasanth wrote:

for employee in @employees

calculation_value1 = employee.size - employee.size

# first is original value (employee.size) and second is modified

value (employee.size)

total = total + calculation_value1

end

Combining that with:

eg:- (consider 5th employee)

calculation_value1 = original_employee[5].size -

modified_employee[5].size

And the examples everyone has provided, you have choices like:

@orig_employees.each_with_index |orig_employee, i|

mod_employee = @mod_employees[i]

calc_val1 = orig_employee.size - mod_employee.size

total = total + calc_val1

end

or:

(0...@orig_employees.length).each |i|

orig_employee = @orig_employees[i]

mod_employee = @mod_employees[i]

calc_val1 = orig_employee.size - mod_employee.size

total = total + calc_val1

end

# (yes, that was 3 dots in the range, not 2)

or:

@orig_employees.length.times |i|

orig_employee = @orig_employees[i]

mod_employee = @mod_employees[i]

calc_val1 = orig_employee.size - mod_employee.size

total = total + calc_val1

end

There are many ways you can do this using the solutions provided. Note

that you *don't* need 2 indexes, since you say both arrays will be the

same length. One index is enough to refer to both arrays.