⟩ Tell me what are blocks and procs?
A block is basically Ruby’s version of a closure—a block of code that can be wrapped up into a proc (a type of function) that can then be stored in a variable or passed to a method and run when desired. Blocks can syntactically be written as blocks of code between { } or the do and end keywords. The standard way to create a proc is depicted in the code block below.
> my_proc = Proc.new { |arg1| print "#{arg1}! " }