Modifiers

Learn about function modifiers in Solidity.

Understanding modifiers

Function modifiers change the behavior of a function by adding requirements. The function body is placed wherever the special symbol _; appears in a modifier’s definition. So, if the modifier condition is met while invoking this method, the function is executed; otherwise, an exception is raised.

Here’s the syntax to declare a modifier:

Get hands-on with 1200+ tech skills courses.