Skip to content

Instantly share code, notes, and snippets.

@raj-pranav
Last active January 15, 2022 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raj-pranav/a4642949b9f6df7f08d931f4f77a727b to your computer and use it in GitHub Desktop.
Save raj-pranav/a4642949b9f6df7f08d931f4f77a727b to your computer and use it in GitHub Desktop.
Learn solidity from the basics
// SPDX-License-Identifier: MIT-License
pragma solidity ^0.8.0;
contract first_sample {
}
// SPDX-License-Identifier: MIT-License
pragma solidity >0.5.0 <=0.9.0;
contract Organization {
uint16 num_of_emp = 100; // This will be stored on blockchain and costs money
uint public total_Turnover = 100000000; //accessible from outside
}
// Tutorial Link on State Variable: https://github.com/raj-pranav/learn-solidity/blob/main/Tutorials/3-state_variable_solidity.md
// SPDX-License-Identifier: MIT-License
pragma solidity >0.5.0 <=0.9.0;
contract xyz {
uint16 public myHeight = 184; // state variable 'myHeight' is declared and assigned a value
string public myName; // state variable 'myName' is declared and will be assigned value using constructor
uint public myPay; // state variable 'myPay' is declared and value will be assigned using function setPay
constructor() {
myName = 'ETH';
}
function setPay() public {
myPay = 420000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment