embark/test_apps/coverage_app/contracts/loops.sol

22 lines
384 B
Solidity
Raw Normal View History

pragma solidity ^0.4.23;
contract Loops {
uint public storedData;
constructor(uint initialValue) public {
storedData = initialValue;
}
function set(uint x) public {
for(uint i = storedData; i < x; i++) {
uint newValue = storedData + x;
storedData = newValue;
}
}
function get() public view returns (uint retVal) {
return storedData;
}
}