Yield to the Block!
Use
yield
from within a method to hand control over to a block:
# define the thrice method
def
thrice
yield
yield
yield
end
# Output "Blocks are cool!" three times
thrice
{
puts
"Blocks are cool!"
}