Last active
January 30, 2017 11:23
-
-
Save n1c01a5/c684a67416ff715439d8567f7b47e353 to your computer and use it in GitHub Desktop.
#2 – basic iterator smart contract on Ethereum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract BasicIterator | |
{ | |
uint8[10] integers; | |
function BasicIterator() { | |
uint8 x = 0; | |
while(x < integers.length) | |
{ | |
integers[x] = x; | |
x++; | |
} | |
} | |
function getSum() returns (uint) { | |
uint8 sum; | |
uint8 x; | |
while(x < integers.length) | |
{ | |
sum += integers[x]; | |
x++; | |
} | |
return x; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment