I'm learning Solidity and I'm stuck on memory vs storage vs calldata. I'm reading the documentation and found this:
Explicit data location for all variables of struct, array or mapping types is now mandatory. This is also applied to function parameters and return variables
Yet with an example contract of:
contract ExampleContract {
string public myText = "Hello, world!";
function getMyText() public view returns (string) {
return myText;
}
}
I get an error telling me Data location must be "memory" or "calldata" for return parameter in function, but none was given.
.
Why is there a requirement for strings to have explicitly defined data allocation (e.g. in function params or returns)?