Escolar Documentos
Profissional Documentos
Cultura Documentos
Objectives : In this lesson, students will learn about: 1.the concept of repeating a set of actions. 2.the syntax of command REPEAT. 3.the application of REPEAT in Logo programming.
Nested REPEAT
Prior knowledge : the application of commands FD, BK, RT, LT, CS Final product expected : draw the following figure with the command REPEAT 15 [FD 100 REPEAT 5 [FD 50 RT 144] BK 100 RT 24]
Nested REPEAT
REPEAT
The syntax : REPEAT # [xxx]
where # refer to a whole number, and xxx refer to a command.
FOR EXAMPLE FD 10 REPEAT 20 [FD 10] RT 10 REPEAT 18 [RT 10]
REPEAT
GUESS
REPEAT 5 [FD 100 BK 50] REPEAT 4 [FD 100 BK 150] REPEAT 2 [FD 100 RT 90]
REPEAT
REPEAT 2 [FD 100 RT 90]
REPEAT
REPEAT 2 [FD 100 RT 90 FD 200 RT 90]
REPEAT
3 parameters for polygons: the number of repetition the turning angle the lengths.
triangle
Number of repetition / sides Turning angle 3
pentagon
5
hexagon
6
120
72
60
REPEAT
3 parameters for stars: the number of repetition the turning angle the lengths.
number of points turning angles 5
144
9
160
15
168
25
172.8
REPEAT
FD 100 REPEAT 3 [FD 50 RT 120] BK 100
REPEAT
FD 100 REPEAT 5 [FD 50 RT 144] BK 100
Nested REPEAT
REPEAT 15 [FD 100 REPEAT 5 [FD 50 RT 144] BK 100 RT 24]
Nested REPEAT
REPEAT 25 [FD 250 REPEAT 25 [FD 50 RT 172.8] RT 172.8]