'How to add response to HelloWorld in Solidity 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...
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?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|