I want to do something different with the last loop iteration when performing \'foreach\' on an object. I\'m using Ruby but the same goes for C#, Java etc.
Similar to kgiannakakis's answer:
list.first(list.size - 1).each { |i| puts "Looping: " + i } puts "Last one: " + list.last