On 20 October 2010 11:13, PalaniKannan K <[email protected]> wrote: > Hi, > > <% source.strains.each_with_index do |strain, j| %> > <% if (j == (source.strains.size - 1)) %> > <font size="3">Strain <%= strain[0].appendix %> </font> > <% end %> > <% end %> > > I need to get output as > > If j value is last one of a loop, then i need to print first value of loop > (j[0]). Kindly suggest me or correct above script.
Do you realise you are doing nothing at all with all the other members of the array? If that is what you want then why bother to iterate through the array, just display element 0. Not related to your question but it is better to use css rather than inline font tags. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

