I am trying to get the current value for my int variable counterforindex in the check function. However this doesn't seem to happen.

uint public counterforindex;

function Check(string hdata, string dtime) returns(bool out1)


    uint C1 = 0; 
    C1 = this.counterforindex; //The error occurs here

The error is as follows

Error: Type function () returns (uint256) is not implicitly convertible to expected type uint256.
        C1 = this.counterforindex;

Any solution guys?????


Adding parenthesis as C1 = this.counterforindex(); should do the trick as explained on this StackOverflow question

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.