From: David Masover Date: 2008-06-04T04:57:29+09:00 Subject: Re: Beginner help On Tuesday 03 June 2008 13:38:38 Justin To wrote: > def meth(proc) > yield("hello") > end > > meth(proc) {|var1| puts "block" } I'm not sure that's right. Basic way to do this would be: def meth yield("hello") end meth { |var1| puts "block" } Looking at your original message, are you wanting to do this with two blocks/procs? For example: def meth(some_proc) some_proc.call 'calling proc' yield 'calling block' end meth(lambda{|x| puts x; puts 'in proc'}) {|x puts x; puts 'in block'} That is really, really cumbersome to use. I haven't found a good way around it, though... > Ok... I think I'm just confused about the above example... when i run > this an error comes up: > blank.rb:5:in `proc': tried to create Proc object without a block > (ArgumentError) > from blank.rb:5 The 'proc' method, by itself, is trying to create a Proc object. So, for example: foo = proc { |var1| puts "block" } Now "foo" is the proc, and can be passed around.