Skip to content

Instantly share code, notes, and snippets.

@AyDeveloper
Last active August 16, 2022 17:35
Show Gist options
  • Save AyDeveloper/d8c5c6f5272cde59617e6b897610d360 to your computer and use it in GitHub Desktop.
Save AyDeveloper/d8c5c6f5272cde59617e6b897610d360 to your computer and use it in GitHub Desktop.
// This line tells us that the source code is licensed under the GPL version 3.0.
// SPDX-License-Identifier: GPL-3.0
// This line specifies that the source code is written for Solidity compiler version 0.7.0
// or a newer version of the language up to, but not including version 0.9.0.
pragma solidity >=0.7.0 <0.9.0;
// A contract is declared using a contract keyword followed by the contract's name
contract Storage {
// This line declares a state variable
// called number of type uint (unsigned integer of 256 bits).
uint256 number;
// This function store() can be used to modify the value of the variable
function store(uint256 num) public {
number = num;
}
// This function retrieve() can be used to retrieve the value of the variable.
function retrieve() public view returns (uint256){
return number;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment