From: Love U Ruby Date: 2013-02-25T01:11:38+09:00 Subject: Re: How should I print only the last combination when using Array#combination(n) ? see the below code : >> a = [1,2,3,4,5] => [1, 2, 3, 4, 5] >> a.combination(3){|arr| p arr} [1, 2, 3] [1, 2, 4] [1, 2, 5] [1, 3, 4] [1, 3, 5] [1, 4, 5] [2, 3, 4] [2, 3, 5] [2, 4, 5] [3, 4, 5] => [1, 2, 3, 4, 5] Here,say I want to see the output only(without any fancy I write it here,just to get to see the trick): [1, 3, 5] #~~ means 5th combination [2, 3, 5] #~~ means 8th combination But yes only with block. Hope it is now clear to you @tamouse. My last reply went to you by mistake without the output being written by me. I tried to edit,but it passed then 15 mins,thus couldn't. Thanks -- Posted via http://www.ruby-forum.com/.