-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathline8.sol
More file actions
37 lines (30 loc) · 691 Bytes
/
line8.sol
File metadata and controls
37 lines (30 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-License-Identifier: MIT
//SPDX-License-Idetifier: Unlicensed
// Loops in solidity
// 1. for loop
// 2. while loop
// 3. do-while loop
pragma solidity >=0.7.0;
contract loops {
uint public val = 4;
uint public val2 = 3;
uint public val3 = 2;
uint public val4 = 1;
function forloop() public view returns(int){
for(int i=0;i<val;i++){
return i;
}
}
function whileloop() public view returns(uint){
uint i=0;
while(i<val){
return i;
}
}
function dowhileloop() public view returns(uint){
uint i=0;
do{
return i;
}while(i<val);
}
}