From: Love U Ruby Date: 2013-02-24T23:55:12+09:00 Subject: How should I print only the last combination when using Array#combination(n) ? >> a = [1,2,3] => [1, 2, 3] >> a.combination(2) => # >> a.combination(2).to_a => [[1, 2], [1, 3], [2, 3]] >> 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] 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/.