pragma solidity ^0.5.0; contract HelloWorld { string public hello = "Hi, Hello World from swzhouu!"; uint256 a = 125; uint256 b = 10; uint256[] private numbers; mapping(string => uint256) public keyValueStore; mapping(string => bool) public hashValue; uint256 public keyValueLength; constructor(uint256[] memory initData) public { numbers = initData; } function pushNumber(uint256 newNumber) public { numbers.push(newNumber); } function getNumber(uint256 index) public view returns(uint256) { return numbers[index]; } function getNumberLenght() public view returns(uint256) { return numbers.length; } function setKeyValue(string memory key, uint256 value) public { keyValueStore[key] = value; if (hashValue[key] == false) { keyValueLength += 1; } else { if (value == 0) { keyValueLength -= 1; } } hashValue[key] = true; } //function hashValue(string memory key) public view returns(bool) { // return keyValueStore[key] != 0; //} function GetSumofAandB() public view returns(uint256) { return a + b; } function GetA() public view returns(uint256) { return a; } function SetA(uint256 newA) public { a = newA; } function SetAandB(uint256 newA, uint256 newB) public { a = newA; b = newB; } }
0.4.18