From: bernhard stoecker Date: 2012-09-11T19:31:36+09:00 Subject: hand over block to a submethod hi @ all, lets assume I have two methods in class Func class Func def self.mean(array) return 0 if(array.size == 0) if(block_given?) return array.map{|x| yield(x)}.sum.to_f / array.size end return array.sum.to_f / array.size end def self.variance(array) return 0 if array.size == 0 avr = Func.mean(array) #HOW TO HAND OVER A BLOCK??? if(block_given?) return array.map { |i| (yield(i) - avr)**2 }.sum / array.size end return self.map { |i| (i - avr)**2 }.sum / self.size end end my problem is, that i have to hand over the block given to variance to the mean method. is this possible and if yes how? thanks in advance greets bernhard -- Posted via http://www.ruby-forum.com/.