Question: how yield works in ruby?
Answer: When yield is called in side a method then method requires a block with in it. A block is simply a chunk of code, and yield allows us to inject that code at some place into a method. Simple Yield: When the yield keyword used inside the body of a method, will allow us to call that method with a block of code.