Created
April 23, 2022 17:25
-
-
Save Amit0617/0728a63ea76f4ff1cce5ca07259bf32d to your computer and use it in GitHub Desktop.
Store a number and retreive its value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SPDX-License-Identifier: MIT | |
pragma solidity 0.8.7; | |
contract HelloWorld { | |
// Declaring a global variable that stores the number | |
uint myNumber; | |
/** @dev Store a given number into a variable | |
* Input - unsigned integer | |
* @param num value to myNumber | |
*/ | |
function storeNumber(uint num) public { | |
myNumber = num; | |
} | |
/** @dev Return the stored number | |
* Output - unsigned integer | |
* @return value of myNumber | |
*/ | |
function retrieveNumber() public view returns(uint) { | |
return myNumber; | |
} | |
} //closing contract 'HelloWorld' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment