Skip to content

Instantly share code, notes, and snippets.

@zabirauf
Created April 16, 2018 01:23
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 zabirauf/7adef6627e81124a66d9b4e670218edc to your computer and use it in GitHub Desktop.
Save zabirauf/7adef6627e81124a66d9b4e670218edc to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.21;
contract GlobalCalculator_V1 {
uint[] internal _nums;
function addNum(uint x) public {
_nums.push(x);
}
function getSum() public view returns (uint sum) {
for (uint i = 0; i < _nums.length; i++) {
sum += _nums[i];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment