Challenge 1: Capture and Call a Block — Solution def repeat_message(times, &block) (1..times).each do |n| block.call(n) end end repeat_message(3) do |n| puts "Attempt #{n}" end =begin Output: Attempt 1 Attempt 2 Attempt 3 Notes: - &block in the method signature captures whatever block is passed to repeat_message and turns it into a real Proc object, stored in the local variable block. - block.call(n) invokes that Proc explicitly, passing the current iteration number as an argument each time through the loop. - The block itself, { |n| puts "Attempt #{n}" } written with do...end at the call site, receives n as its own block parameter and interpolates it into the message. =end