1
pragma solidity ^0.4.18;

contract graduate{
     uint studentId;
     string name;
     string major;
     uint totalGrade;

     function setGraduate(uint x, string y, string z, uint v) public{
           studentId = x;
           name = y;
           major = z;
           totalGrade = v;
     }

    function getGraduate() public view returns (uint _studentId,string _name,string _major,uint _totalGrade){
          return studentId;
          return name;
          return major;
          return totalGrade;
    }

}

browser/graduate.sol:17:9: TypeError: Different number of arguments in return statement than in returns declaration.

return studentId;

^--------------^

same on 4 arguments.

0

Change this:

return studentId;
return name;
return major;
return totalGrade;

To this:

return (studentId,
        name,
        major,
        totalGrade);
  • And BTW, what does totalGrade - v; suppose to do??? – goodvibration Apr 7 at 12:58
  • The problem has been resolved. Thank you. – sehiiiy Apr 7 at 14:00
  • And "totalGrade - v" is a typo.... thank you. – sehiiiy Apr 7 at 14:02

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.