From: L Forrister Date: 2007-04-03T14:01:15+09:00 Subject: Re: Last iteration condition On 4/2/07, Mike wrote: > How could I know that current iteration is the last in the series? > [1, 2, 3, 4, 5, 3, 4].each do |element| > print element.to_s > print ',' if !LAST > end [1, 2, 3, 4, 5, 3, 4].each_index do |index| print ',' if index > 0 print element[index].to_s #-- or -- if the logic "print ',' " is actually dependent on the values of the elements print element[index-1].to_s end ~~LF