We want to define a method that will use a proc and then we want to use this method to see if it works.
First we define our method
greeter with only a
Then we define our proc
phrase with a simple
puts in it.
Then we call our
greeter method and pass it the proc.
Inside the method, it only has
yield, which means that it will simply switch to the proc directly, then we’re inside the proc, we use
puts, and then the proc is finished.
Since a proc doesn’t return to the method, we have nothing left to execute, the program ends (the method had nothing else to execute other than the yield anyway, so it would have ended anyway).