I have already put “public” before “returns”, it said “from solidity:
Warning: Function state mutability can be restricted to view
–> ETH SC Security/Overflow.sol:13:5:
|
13 | function getBalance() public returns (uint) {
| ^ (Relevant source part starts here and spans across multiple lines).”
Then when I change “public” to “view” as below
function getBalance() public returns (uint) {
return balance[msg.sender];
}
it said
“from solidity:
SyntaxError: No visibility specified. Did you intend to add “public”?
–> ETH SC Security/Overflow.sol:13:5:
|
13 | function getBalance() view returns (uint) {
| ^ (Relevant source part starts here and spans across multiple lines).”
What should I do?