What differences, if any, exist between the Kernel#at_exit method and the END (all upper case) keyword? Is the latter merely a more Perlish way of doing things, and the former more Ruby-esque?
I tried doing defined?(END {puts "Bye"}), but got a syntax error.
“The Ruby Programming Language” defines a minor difference in their behavior.
at_exitcan be called multiple times when within a loop and each iterated call will be executed when the code exits.ENDwill only be called once when inside a loop.So, running:
results in: