Created
January 8, 2023 14:16
-
-
Save bluenights004/f68a4af1c8f005267b982e85ddf16233 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.17+commit.8df45f5f.js&optimize=false&runs=200&gist=
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.17; | |
contract gettersandsetters { | |
// Declare variables | |
uint256 public myUint; | |
int public myInt; | |
string public myString; | |
bool public myBool; | |
// Set functions | |
function setUint(uint256 _newUint) public { | |
myUint = _newUint; | |
} | |
function setInt(int _newInt) public { | |
myInt = _newInt; | |
} | |
function setString(string memory _newString) public { | |
myString = _newString; | |
} | |
function setBool(bool _newBool) public { | |
myBool = _newBool; | |
} | |
// Get functions | |
function getUint() public view returns (uint256) { | |
return myUint; | |
} | |
function getInt() public view returns (int) { | |
return myInt; | |
} | |
function getString() public view returns (string memory) { | |
return myString; | |
} | |
function getBool() public view returns (bool) { | |
return myBool; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment