如何在坚固的混音中添加对Helloworld的响应?

发布于 2025-01-30 20:05:13 字数 918 浏览 2 评论 0原文

我想将响应添加到这个Hello World示例

helloworld.sol
// SPDX-License-Identifier: MIT
// compiler version must be greater than or equal to 0.8.13 and less than 0.9.0
pragma solidity ^0.8.13;

contract HelloWorld {
    string public greet = "Hello World!";
    string public respond = "Good morning, starshine!"; // trying to add this line
}

在我运行 remix中的合同在我试图添加的行之前,我看到了这一点。 ..

“

我希望在添加的行是另一个称为响应的按钮后看到的内容,当我按下它时,我希望下面会读取:

字符串:早上好,星际!

但是,相反,我看不到没有添加线路运行时的变化。

我如何实现预期的行为?

I want to add a response to this Hello World example.

HelloWorld.sol
// SPDX-License-Identifier: MIT
// compiler version must be greater than or equal to 0.8.13 and less than 0.9.0
pragma solidity ^0.8.13;

contract HelloWorld {
    string public greet = "Hello World!";
    string public respond = "Good morning, starshine!"; // trying to add this line
}

When I run the contract in Remix before the line I'm attempting to add, I see this...

enter image description here

What I expect to see after my added line is another button called respond and when I press it, I expect below it to read:

string: Good morning, starshine!

But instead, I see no change than when run without my added line.

How do I achieve the expected behavior?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

归途 2025-02-06 20:05:13

我看到您的代码中没有错误
您必须通过单击橙色部署按钮再次重新部署合同

I see no errors in your code
you have to redeploy the contract again by clicking orange Deploy button

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文