From: Shashank Date Date: 2002-08-18T07:02:30+09:00 Subject: Re: Difference between proc.call and yield? The parameter passing is also different, quoting Matz (from ruby-talk 46413): > First, you have to learn several tips: > > (a) block parameter |v| means takes everything in a single variable, > which is better described as |*v|. > > (b) "call" requires exact number of required argument, whereas > "yield" fills nil for fewer arguments and ignores too much > arguments. HTH, -- Shanko "Dan Debertin" wrote in message news:87ptwitcpq.wl@discus.nodewarrior.org... > Consider the following contrived examples: > > def func1() > ret = [] > t = nil > 5.times do |i| > t = yield i > ret << t > end > ret > end > > func1 { |b| b + 10 } # [ 10, 11, 12, 13, 14 ] > > def func2(&block) > ret = [] > t = nil > 5.times do |i| > t = block.call(i) > ret << t > end > ret > end > > func2 { |b| b + 10 } # [ 10, 11, 12, 13, 14 ] > > Is this just TMTOWTDI, or is there a difference? > > Dan > -- > /^Dan Debertin$/ > airboss@nodewarrior.org > www.nodewarrior.org > ignorami: n: > The art of folding problem users into representational shapes. >