Created
June 24, 2018 18:26
-
-
Save wadealexc/9dd0ee04f0e69f11f84adccc4e01d66d to your computer and use it in GitHub Desktop.
This file contains 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
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