28简单存储

// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;

contract SimpleStorage{

    string public text;

    // 用calldata会节约gas
    function set(string calldata _text) external {
        text=_text;
    }

    // 这里把状态变量拷贝到内存中返回
    function get()external view returns(string memory){
        return text;
    }
}