def repeat(times)
  times.times { yield }
end

repeat(3) { puts "Hello!" }
# خروجی:
# Hello!
# Hello!
# Hello!