Skip to content

Instantly share code, notes, and snippets.

@Solexplorer
Last active May 31, 2019 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Solexplorer/1d6ccb452e63a55a197630adf141e6a7 to your computer and use it in GitHub Desktop.
Save Solexplorer/1d6ccb452e63a55a197630adf141e6a7 to your computer and use it in GitHub Desktop.
Store a string inside our Contract and retrieve it
//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