For Loop
Flow-Wing supports the for
keyword to iterate over a sequence of values.
Example Usage:
for var i = 0 to 10 {
print(i + " ")
}
Output:
0 1 2 3 4 5 6 7 8 9 10
Here, the for
keyword is used to iterate over a sequence of values. statment inside loop is executed 11 times. Since By Default, the steper is 1.
With Steper
Flow-Wing supports the for
keyword to iterate over a sequence of values with a steper.
Example Usage:
for var i = 0 to 10 : 2 {
print(i + " ")
}
Output:
0 2 4 6 8 10
Here, the for
keyword is used to iterate over a sequence of values with a steper. statment inside loop is executed 6 times.
For Loop with Array/Container
Flow-Wing supports the for
keyword to iterate over a sequence of values with a steper.
Example Usage:
for var i = 0 to 5 : 1 {
print(people[i].name + " ")
}
Using Outside Variable
var i: int = 0
for i = 0 to 5 : 1 {
print(people[i].name + " ")
}