by kaiuhl · 1y ago · 0 comments
class Integer
def times(&blk)
i = 0
while i < self
blk.call(i)
i += 1
end
end
endNo, they aren't.
Blocks can be reified into instances of the Proc class, but they are not objects and reifying them into objects has overhead.
Using a & argument asks for a block passed to the method to be reified into a proc accessible in the body of the method, which is useful if you are going to do something with it that you can't do with a bare block.