0

With the following, I attempt to test it, but nothing happens when I do my set (and therefore my get). No error, no output... nothing. :(

Am I missing something obvious?


pragma solidity >=0.4.22 <0.6.0;

contract MyPLMPOC {

    string private myContractName;
    uint private myContractLength;

    function setContractName(string memory myNewContractName) public {
         myContractName = myNewContractName;
    }

    function getContractName() public  returns(string memory)  {
        return myContractName;
    }


}
1
 function getContractName() public view returns(string memory)  {
        return myContractName;
    }

function with "view" does not create transaction, only read values instantly from state

function without view creates transaction, needing time to be collected in a block.

  • Worked like a charm. I hate when it should be an obvious answer. Drat! – NashParrot Nov 23 '18 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.