Repeat and set commands in Logo (1)
Repeat and set commands in Logo (1)
PSC
1) To identify repeat commands in logo.
2) To analyze the repeat command.
3) To draw polygon using repeat commands in logo.
Task 1
Q1) What is Repeat command and give the general Repeat command for the
polygon?
Ans: Repeat command is used to repeat the set of commands for the given
number of times.
General repeat command is
Repeat Number of sides [FD no of steps RT 360/Number of sides]
TASK2
Q2 Write the repeat command for the following polygons.
Polygon Command
3 sided polygon (Triangle) Repeat 3 [FD 100 RT 360/3]
4 sided polygon (square) Repeat 4 [FD 100 RT 360/4]
5 Sided polygon (pentagon) Repeat 5 [FD 100 RT 360/5]
6 sided polygon (Hexagon) Repeat 6 [FD 100 RT 360/6]
7 sided Polygon (Heptagon) Repeat 7 [FD 100 RT 360/7]
8 sided Polygon (Octagon) Repeat 8 [FD 100 RT 360/8]
9 sided Polygon (nonagon) Repeat 9 [FD 100 RT 360/9]
10 sided polygon (decagon) Repeat 10[FD 100 RT 360/10]
Circle Repeat 360 [FD 1 RT 1]
Semi Circle Repeat 180 [FD 1 RT 1]
Task 3
1. SETPENCOLOR Sets the pen color of the turtle to the given number.
SETPC [R G B] Eg:
i)SETPENCOLOR [255 0 0] sets the turtle pen to
red color
ii) SETPENCOLOR [0 255 0] sets the turtle pen to
green color
iii) SETPENCOLOR [0 0 255 ] sets the turtle pen
to blue color
iv) SETPENCOLOR [0 0 0 ] sets the turtle pen to
black color
v) SETPENCOLOR [255 255 255 ] sets the turtle
pen to white color
2. SETPENSIZE Sets the pen size of the turtle to the given number.
SETPENSIZE [n n] Eg: setpensize [5 5]
n is maximum 7 setpensize [6 6]
setpensize [7 7]