0

I have this error during the compiling of the code below on Remix.

Someone could help me ?

    pragma solidity 0.4.4;
    contract SimpleStorage{
    uint storeddata;
    function set(uint x) public{
        storeddata = x;
    }
    function get() public view returns(uint){
        return storeddata;
    }
}
1

That's not a valid compiler version. (You perhaps missed out a 2, but you'll need to decide which version you actually want to use. Probably a post-0.5.0 version.)

This compiles:

pragma solidity 0.4.24;

contract SimpleStorage {
    uint storeddata;

    function set(uint x) public {
        storeddata = x;
    }

    function get() public view returns(uint) {
        return storeddata; 
    }
}
  • Was just about to answer about the same, but all brackets are correct in original post as well, aren't they? – Lauri Peltonen Feb 1 at 10:09
  • You're right - when I loaded Remix I must have over-written what was already there but missed the last line :-) (Should have ctrl-a-ed!) Thanks for spotting it :-) – Richard Horrocks Feb 1 at 10:14
  • Yes, the problem was the version, thank you so much! – Simone R.C. Feb 1 at 10:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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