Skip to content

Instantly share code, notes, and snippets.

@wadealexc
Created June 24, 2018 18:26
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 wadealexc/9dd0ee04f0e69f11f84adccc4e01d66d to your computer and use it in GitHub Desktop.
Save wadealexc/9dd0ee04f0e69f11f84adccc4e01d66d to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.23;
contract AddSub {
function add(uint a, uint b) internal pure returns (uint) {
return a + b;
}
function sub(uint a, uint b) internal pure returns (uint) {
return a - b;
}
function math(uint _a, uint _b, bool _add) public pure returns (uint) {
function (uint, uint) internal pure returns (uint) func;
func = _add ? add : sub;
return func(_a, _b);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment