- Storage locations
- Account storage
- Replacing memory with calldata for saving gas
https://docs.soliditylang.org/en/latest/types.html#bytes-and-string-as-arrays
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
contract HelloWorld {
string private text;
constructor() {
text = "Hello World";
}
function helloWorld() public view returns (string memory) {
return text;
}
function setText(string calldata newText) public {
text = newText;
}
}