GroIMP Module XL English
Spoken text
To repeat individual parts of a character sequence or the entire character sequence with a certain frequency there is the for-command. The character sequence to be repeated has to be written in round brackets. Only after all repetitions have been performed, the turtle reads the subsequent characters. Basically the principle is similar to a simple for-loop in the programming languages C or Java. The first example shown here illustrates the functioning of this command: Eight times in a row a cylinder of length 1 is drawn with a subsequent rotation of the Turtle of 45° around the left axis. The attached cylinder is thus automatically inclined at this angle. After performing the first loop the turtle moves without drawing and the same loop is executed again.
Another example shows more clearly the possibilities provided by the for-loop: By setting the step length of the turtle before the for-command, it can be reduced in every step by multiplying it with 0.8, so that the subsequent cylinder is becoming shorter with each iteration.