Ok I am trying to figure out why Remix IDE is throwing an error saying the
Data location 'memory' must be given…..
for a string argument but the uint arguments don't throw any error?
pragma solidity >=0.4.25 <0.6.0;
contract Monopoly {
string public player1;
uint32 public player2;
uint32 public player3;
constructor(string memory _player1, uint32 _player2, uint32 _player3) public {
player1 = _player1;
player2 = _player2;
player3 = _player3;
}
}
Best Answer
Have a look here: https://solidity.readthedocs.io/en/latest/050-breaking-changes.html#explicitness-requirements
string
is a specific type of array, so this logic applies.This sort of issue, and the possibility such things might pop up in the future is one reason I incline to specific versions in
pragma
instead of ranges. That way if you switched compilers (possibly without being aware of it) you wouldn't get new and weird issues - just a complaint about the compiler version.Hope it helps.