-
Notifications
You must be signed in to change notification settings - Fork 0
Loops
Frederic Jarjour edited this page May 21, 2022
·
3 revisions
In Kode, for loops do not have a built in counting variable. Instead, the user must set it up themselves. Here is an example of a for loop in Kode:
int i = 0
for i < 10
print(i)
i = i + 1
end for
One very useful application of the for loop is to loop over the values of an array. Here is an example of a for loop that prints the values in an array:
val array = [1, 2, 3]
int i = 0
for i < len(array)
print(array[i])
i = i + 1
end for