Hello, I have just started learning Ruby and have already come upon a
problem:
i'm learning and blocks and procs:
def meth(proc)
puts "before proc"
proc.call
puts "after proc"
yield("hi")
if block_given?
puts "block exists"
else puts "D.N.E."
end
end
meth proc {|var1| puts "block" }
prc = lambda do
puts "inside proc"
end
meth(prc)
the main thing i don't understand is how to create a block when the
original method has an argument? and the block takes an argument....
def meth(proc)
meth proc {|var1| puts "block" }
--
Posted via http://www.ruby-forum.com/.