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 {
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store