Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.5.4;
- contract AddressSetHaver {
- uint[] public testList = [1,2,3,4,5,6];
- uint[] public smallList = [5];
- function emptySmallList() public {
- smallList.length --;
- }
- function wontonlyLengthenTheSmallList() public {
- smallList.length ++;
- }
- function pumpSmallList(uint x) public {
- smallList.push(x);
- }
- function smallListLength() public returns(uint) {
- return smallList.length;
- }
- function yee(uint [] memory bacon) public returns(bool[] memory) {
- bool[] memory copy = new bool[](bacon.length);
- copy[bacon.length -1] = true;
- return copy;
- }
- function add(uint element) public returns (uint) {
- if ( contains(element) ) {
- return testList.length;
- } else {
- return testList.push(element);
- }
- }
- function contains(uint element) public view returns (bool) {
- uint len = testList.length;
- for(uint i = 0; i < len; i++) {
- if(testList[i] == element) {
- return true;
- }
- }
- return false;
- }
- function length() public view returns (uint) {
- return testList.length;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement