The syntax for count-based loops is as follows:
Example:
shape = ellipse(250, 250, 300, 300)
i = 0
repeat(3):
new_shape: Object = ellipse(250, 250, 300-i*10, 300-i*10)
shape += new_shape
i += 1
shape.draw(1, 1000)
The syntax for data structure-based loops is as follows:
Example:
fruits = ["apple", "banana", "tomato"]
i = 0
new_txt: Text = ""
txt_box: Object
for i in fruits:
new_txt += i
txt_box.write(new_txt, 100, 100)
txt_box.draw(1, 1000)
The syntax for data precondition-based loops is as follows:
Example:
shape = ellipse(110, 110, 30, 30)
i = 4
while(i > 0):
new_shape: Object = ellipse(100+i*10, 100+i*10, 30, 30)
shape += new_shape
i -= 1
shape.draw(1, 1000)