Skip to content

Instantly share code, notes, and snippets.

@hydai
Created September 17, 2020 17:04
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 hydai/60c3ffdf4e91c67032a50979e24db8d5 to your computer and use it in GitHub Desktop.
Save hydai/60c3ffdf4e91c67032a50979e24db8d5 to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.8.0;
contract Calc {
int private result;
function add(int a, int b) public returns (int c) {
result = a + b;
c = result;
}
function min(int a, int b) public returns (int) {
result = a - b;
return result;
}
function mul(int a, int b) public returns (int) {
result = a * b;
return result;
}
function div(int a, int b) public returns (int) {
result = a / b;
return result;
}
function getResult() public view returns (int) {
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment