Warning: Function state mutability can be restricted to pure function

Alo*_*159 19 ethereum solidity

I am new to solidity and I have been trying to print out simple messages using functions in solidity, but I have failed to deploy successfully, and there is an error that I can not figure out what's wrong.

This is what I have tried so far:

 pragma solidity ^0.6.0;
    
    contract test {
        
        string public _feedback;
        
        function reply(string memory feedback) public
        {
           feedback = "Well done!";
        }
    }
Run Code Online (Sandbox Code Playgroud)

The error I am receiving is "Warning: Function state mutability can be restricted to pure function"

小智 22

编译器只是警告函数回复的执行结果是固定的,并且“规范地”可以通过向其添加纯说明符来指示:

        function reply(string memory feedback) public pure
        {
           feedback = "Well done!";
        }
Run Code Online (Sandbox Code Playgroud)

但即使没有这种更改,合约也将被正确编译和创建。仅以目前的形式,您将无法以任何方式理解它的作用:-)