Introduction
Blocks let you send extra instructions to a method. Checking if a block is given helps your method decide if it should run those extra instructions or not.
When you want a method to do something extra only if the user provides a block.
When you want to avoid errors if a method tries to use a block but none was given.
When you want to make your method flexible and optional for extra code.
When you want to run default code if no block is provided.
When you want to customize behavior inside a method based on the presence of a block.