$ cat testscript.rb #!/usr/bin/env ruby def normal_welcome puts "about to execute:" yield puts "finished executing" end normal_welcome do puts 1 + 1 puts 2 + 2 puts 3 + 3 puts 4 + 4 end
The above outputs:
Announcement
You can find all my latest posts on medium.$ ./testscript.rb about to execute: 2 4 6 8 finished executing