Skip to content

Instantly share code, notes, and snippets.

@Jesserc
Created March 23, 2024 11:37
Show Gist options
  • Save Jesserc/c217620a1a4636449a4da20fedae8cc2 to your computer and use it in GitHub Desktop.
Save Jesserc/c217620a1a4636449a4da20fedae8cc2 to your computer and use it in GitHub Desktop.
For Ethereum Dev workshop
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
contract MyFirstContract{
// string, integers (uint, int), address
address myAddress = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4;
uint number = 2024;
int negativeNumber = -2024;
string name = "Jesserc";
function retrieveAllVars() public view returns(address,uint,int, string memory){
return (myAddress,number,negativeNumber,name);
}
function updateAddress(address newAddr) public {
myAddress = newAddr;
}
function updateNumber(uint newNumber) public {
number = newNumber;
}
function updateNegNumber(int newNegNumber) public {
negativeNumber = newNegNumber;
}
function updateName(string memory newName) public {
name = newName;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment