Topic: Loop with different behavior for last item?
I am trying to loop through a group of objects in my RHTML and display their names/links plus a separator. But I don't want a separator after the last one. Is there a clean way to do this with Ruby? (I changed this from RHTML to Ruby for this code snippet):
for crumb in @breadcrumbs
puts " - " # separator
That gives me: Mike - Bob - Steve - Joe -
What I want is: Mike - Bob - Steve - Joe