To repeat a piece of code, we use loops. In Csq, there are two types of loops: while and for.
The while loop will execute a block of statements until the condition is true.
i := 0
while i < 5:
print i
i = i + 1
Csq supports for loops which is an iterator based loop just like Python. To use it you can either use existing functions like range or create a list to traverse.
Using range function
for i in 1->10:
print i
Output:
0.000000
1.000000
2.000000
3.000000
4.000000
5.000000
6.000000
7.000000
8.000000
9.000000