Skip to content

Instantly share code, notes, and snippets.

@svanas
Last active October 1, 2023 13:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svanas/104bc3757dedb8f3c8ad70d747f7b620 to your computer and use it in GitHub Desktop.
Save svanas/104bc3757dedb8f3c8ad70d747f7b620 to your computer and use it in GitHub Desktop.
Increment and decrement operations using Solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
contract ArithValue {
uint number;
constructor () {
number = 100;
}
function setNumber(uint value) public {
number = value;
}
function getNumber() public view returns (uint) {
return number;
}
function incrementNumber() public {
number = number + 1;
}
function decrementNumber() public {
number = number - 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment