Solidity: The function modifiers
Function modifiers allow you to change the behavior of a function, such as adding a prerequisite to a function.
The body of the function is inserted at the location of the _;
symbol.
If the condition of the modifier is satisfied when the function is called, it is executed. Otherwise, an exception is thrown.
Let’s create a smart contract:
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;contract MyContract {
}