def fun()
    "yielded #{yield}"
end

puts fun() { 'regular block ' }
puts fun(&-> { 'block passed as argument' })

def fun(&block)
    "called #{block.call}"
end 

puts fun() { 'regular block' }

def fun(block)
    "called #{block.call}"
end 

puts fun(-> { 'block passed as argument' })


Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: