From: tamouse mailing lists Date: 2013-02-25T00:30:40+09:00 Subject: Re: How should I print only the last combination when using Array#combination(n) ? On Sun, Feb 24, 2013 at 9:15 AM, Love U Ruby wrote: > tamouse mailing lists wrote in post #1098785: >> On Sun, Feb 24, 2013 at 8:55 AM, Love U Ruby >> wrote: >>> 2~~>[1, 2]=>[1, 2] >>> 2~~>[1, 3]=>[1, 3] >>> 2~~>[2, 3]=>[2, 3] >>> => [1, 2, 3] >>> >>> Any chance to get only the last combination,i.e [[2,3]] or 2~~>[2, >>> 3]=>[2, 3] ? >>> >>> -- >>> Posted via http://www.ruby-forum.com/. >>> >> >> 1.9.3-head :001 > [1,2,3].combination(2).to_a.last >> => [2, 3] > > Yes! but if I use block then any chance to control the same. as an > example I said here last. It can be any specific number. But yes > obviously when using with block. > > -- > Posted via http://www.ruby-forum.com/. > I have no idea what you're saying there. Other than get the last combination, what is it you actually want to do? What is the application?