From: Love U Ruby Date: 2013-02-25T00:40:25+09:00 Subject: Re: How should I print only the last combination when using Array#combination(n) ? tamouse mailing lists wrote in post #1098790: > On Sun, Feb 24, 2013 at 9:15 AM, Love U Ruby > wrote: >>>> >> >> -- >> 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? Okay! I want to write a one liner which can give me the below output: which is currently I am not able by the below block code with combination,as in the below block I couldn't track the,say,when second 'arr' is coming just print it,but not the others.: >> a.combination(2){|arr| print arr.length;print "~~>";print arr ; print "=>" ; p arr} 2~~>[1, 2]=>[1, 2] 2~~>[1, 3]=>[1, 3] 2~~>[2, 3]=>[2, 3] => [1, 2, 3] Please let me know if still my need confuses you. -- Posted via http://www.ruby-forum.com/.