Created
August 14, 2021 18:28
-
-
Save Davidegloh/73c11cd0e0cffe532cffab79bdf07694 to your computer and use it in GitHub Desktop.
[Loops-Solidity]#loops
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
//Loops | |
//While loop | |
pragma solidity 0.7.5; | |
contract HelloWorld { | |
function count(int number) public pure returns(int){ | |
int i = 0; | |
while (i < 10){ | |
number++; | |
i++; | |
} | |
return number; | |
} | |
} | |
//For loop | |
contract HelloWorld { | |
function count(int number) public pure returns(int){ | |
for(int i=0; i<10;i++){ | |
number++; | |
} | |
return number; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment