Ruby Language Reference

END statement

Syntax

END {
  code
}

The END statement declares code that is executed when the program ends.

Example

END {
  p 'exiting the program'
}

This prints:

exiting the program

and the program ends.


Sharing is Caring