What is difference in below usage
a = proc { puts 'hii' }
def abc(&a)
a.call
end
abc(&a)
def xyz(c)
c.call
end
xyz(a)
In below implementation more than one blocks can be passed as arguments –
def pqr(c, &t)
c.call
yield
xyz(c)
abc(&t)
end
pqr(a) { puts 'block to method'}
In the first of the two, the
&aparameter will also capture a block passed like this:This is the same as:
The other of the two only allows the last of the two.