> For the complete documentation index, see [llms.txt](https://docs.optimumsec.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.optimumsec.xyz/coding/revert-return-early.md).

# Revert/Return Early

Reverting or returning early in a function is a useful way to improve code clarity, maintainability and save gas. By terminating execution when certain conditions aren't met—like failed input validation or access control—unnecessary logic is skipped, and any changes are rolled back, ensuring contract integrity.
