Remix
How to compile, deploy and interact with a solidity smart contract on chain
Deploying your first smart contract
Creating other contracts
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Counter {
uint256 private counter;
constructor() {
counter = 0; // Initialize counter to 0
}
function incrementAndGet() public returns (uint256) {
counter += 1; // Increment the counter
return counter; // Return the updated counter value
}
function getCounter() public view returns (uint256) {
return counter; // Return the current counter value
}
}
Last updated

