Last active
May 31, 2019 18:24
-
-
Save Solexplorer/1d6ccb452e63a55a197630adf141e6a7 to your computer and use it in GitHub Desktop.
Store a string inside our Contract and retrieve it
This file contains 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
//Version of solidity to be used | |
pragma solidity 0.5.0; | |
contract SimpleStorage { | |
// declare variable | |
string storedData; | |
function set(string memory x) public { | |
// Store the string inside the Contract | |
storedData = x; | |
} | |
function get() public view returns (string memory retVal) { | |
// Retrieve the value when calling the function | |
return storedData; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment