I want to know what's wrong with my function, 'cause Visual Studio Code give me warning :
function state mutability can be restricted to view
this is my function :
function verifyVote(address pers) public returns (uint){
for (uint i = 0; i < personne.length; i++){
if (pers == personne[i].own) {
if (personne[i].isVoted == true){
return 1;
}
else{
return 0;
}
}
}
return 404;
}
view
function. VS code is suggesting a best practice and your code will compile even without this. For more information about function state mutability, refer solidity documentation at solidity.readthedocs.io/en/latest/contracts.html#view-functions