On Dec 4, 4:19 pm, MenTaLguY <men... / rydia.net> wrote:
> On Wed, 5 Dec 2007 05:42:21 +0900, MenTaLguY <men... / rydia.net> wrote:
> > On Wed, 5 Dec 2007 05:35:01 +0900, "lpga... / gmail.com" <lpga... / gmail.com>
> > wrote:
> >> Assume I have:
>
> >>    for user in @Users
> >>       put user.name
> >>       put user.name #I want this to be next object in @Users
> >>    end
>
> >> I want the second user.name to be the next object in the list. Is
> >> there a way to do this?
>
> > Of course.  But what do you want to happen when you're at the end
> > of the list and there is no longer a next object?
>
> That is, if you only care about pairs of users, then you can do this:
>
>  prior = nil
>  for user in @Users
>    if prior
>      put prior.name
>      put user.name
>    end
>    prior = user
>  end
>
> Obviously that won't print anything if there is only one entry in
> @Users, though.
>
> -mental

I figured it out... You can use in_group_of