Exercise: Writing Functions

Practice writing functions in Solidity.

Now, it's time to practice our newly-acquired skills and try to write a few functions ourselves.

In all exercises, a starter code will include several TODO comments, which we'll need to replace with a correct implementation.

Increment function

For the first exercise, we need to define a function that increments the state variable in our smart contract. To implement it, find the following TODO statement and replace it with the function implementation:

Get hands-on with 1400+ tech skills courses.