From: "Mikael Høilund" Date: 2008-07-15T19:09:02+09:00 Subject: Re: Displaying array elements in order On Jul 15, 2008, at 11:28, Pragash Mr. wrote: > a=[12,354,633,68,85] > <%for i in a%> > <%z=Document.find(i)%> > <%=z.name%> > <%end%> > > Here the result is displaying randomly in browser > but i want to display the result in the array order > i.e first 12 then followed by 354,633,68,85 If that's happening, the array is ordered randomly before the `for` construct. Arrays are inherently ordered, so using a `for` will always yield the elements in the order they appear in the array. Try inspecting the array before looping over it to see which order the elements are in. -- Mikael Høilund http://hoilund.org/