From: Love U Ruby Date: 2013-02-25T00:15:21+09:00 Subject: Re: How should I print only the last combination when using Array#combination(n) ? 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/.