Loading...
Every contract starts the same way: license, pragma, contract definition. Then state and functions.
solidity// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; contract Hello { string public greeting; constructor(string memory _greeting) { greeting = _greeting; } function setGreeting(string memory _greeting) public { greeting = _greeting; } }
^0.8.24 means "0.8.24 or any 0.8.x newer".public auto-generates a getter function.Write a contract Counter with a uint256 public count and a function increment() that increases it by 1.