I did copy paste your code and it works fine (although there are some warnings!). Once you deployed the contract (with the deploy button) you can call your function with the getValue button.
![enter image description here](https://i.stack.imgur.com/KhCIw.png)
You should see the result in the bottom gray box. It shouws the whole transaction and also the decoded output.
![enter image description here](https://i.stack.imgur.com/c6WaK.png)
UPDATE
According to the yellow paper:
![enter image description here](https://i.stack.imgur.com/mYpDh.png)
Essentially the output is used only when the message call is performed by the execution of a contract code. Otherwise, i.e. when the message call is due to a transaction (that triggers the execution) the output should be ignored, as reported.
In Solidity you can return values from functions to the user if these functions are declared view(/constant).
When they are not declared as view you can still get a return value by using .call() this will execute the call locally and not mine it onto the blockchain however.
Return values do play a big role as they can be returned to other functions even when the function is not view/constant. I'll give a real world example.
The following function creates a new 'bounty' on a bounty contract, it returns a bytes32 value.
function createBounty(
BountyInterface.Bounty storage _bounty,
string _title,
string _issueURL,
string _reference,
uint _deadline,
address _issuer,
uint _reward
) external returns (bytes32) {
bytes32 _index = keccak256(abi.encodePacked(_issueURL));
_bounty.bounties[_index].title = _title;
_bounty.bounties[_index].issueURL = _issueURL;
_bounty.bounties[_index].reference = _reference;
_bounty.bounties[_index].timestamp = block.timestamp;
_bounty.bounties[_index].deadline = _deadline;
_bounty.bounties[_index].status = BountyInterface.statusOptions.ACTIVE;
_bounty.bounties[_index].issuer = _issuer;
_bounty.bounties[_index].reward = _reward;
_bounty.bounty_indices.push(_index);
emit logCreateBounty(_issuer, msg.sender, _title, _reward);
return _index;
}
The return value is then sent to this function on another contract. This will store the return value in an array so that the newly created bounty is associated with a user as well:
function createBounty(address _group, string _title, string _issueURL, string _reference, uint _deadline, uint _reward) external {
bytes32 _index = Group(_group).createBounty(_title, _issueURL, _reference, _deadline, msg.sender, _reward);
People(ContractProvider(CMC).contracts("people-storage")).addBounty(_group, _index, msg.sender);
}
Best Answer
You can try events, check this out: https://solidity.readthedocs.io/en/v0.5.10/structure-of-a-contract.html?highlight=events#events