mirror of https://github.com/embarklabs/embark.git
22 lines
384 B
Solidity
22 lines
384 B
Solidity
|
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;
|
||
|
}
|
||
|
}
|