Skip to content

Instantly share code, notes, and snippets.

@vsaraph
Created February 28, 2019 19:36
Show Gist options
  • Save vsaraph/42a75d6d18f35331368f414ea76fde39 to your computer and use it in GitHub Desktop.
Save vsaraph/42a75d6d18f35331368f414ea76fde39 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=
pragma solidity ^0.5.1;
contract Stack {
int256[] stack;
function push(int256 data) public {
stack.push(data);
}
function pop() public returns (int256 data) {
data = stack[stack.length - 1];
stack.length -= 1;
}
function incTop() public {
int256 data = pop();
data += 28;
push(data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment