Function Modifiers and Events

Use function modifiers to set logical prerequisites for the execution of functions in Solidity.

We'll cover the following

Modifiers

Function modifiers are instructions that change the behavior of a function that they are attached to. They are commonly used to define logical conditions that must be satisfied for a call to a function to be made.

A modifier is declared with the modifier keyword and specifies the logical condition to be verified with the require keyword (with an optional revert message). If the condition is met, the execution of the function follows and is indicated by the _; command.

Get hands-on with 1200+ tech skills courses.