Ruby - Blocks, Procs, and Lambdas
Given the method below, what will be the output?
def repeat(n)
if block_given?
n.times { |i| yield(i) }
else
puts "No block given"
end
end
repeat(3) { |num| puts num * 2 }