Panic statement

The panic statement terminates the execution of a function with a panic and sets its panic result.
Any deferred statements registered by the function will then be executed in reverse order, which may alter the function's result.
Typically, a function should use fail when encountering invalid input (user errors) and panic for developer errors.

Note that unlike the failure result, the panic result is not part of the function's signature. Panic can be used in any function, with exactly one argument of any type.
Example of defer statement modifying the panic result.