0% found this document useful (0 votes)
2 views

Repeat and set commands in Logo (1)

The document explains the use of repeat commands in Logo programming to create polygons by repeating a set of commands. It provides general syntax for the repeat command and specific commands for various polygons, including triangles, squares, and circles. Additionally, it describes set commands for changing the pen color and size in Logo.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Repeat and set commands in Logo (1)

The document explains the use of repeat commands in Logo programming to create polygons by repeating a set of commands. It provides general syntax for the repeat command and specific commands for various polygons, including triangles, squares, and circles. Additionally, it describes set commands for changing the pen color and size in Logo.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Repeat and Set commands in Logo

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

Q3) Explain the following set commands.

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]

Q4) Write the repeat command for the following.

REPEAT 4[FD 100 RT 360/4]


RT 45
PU
FD 20
PD
LT 45
REPEAT 4[FD 50 RT 360/4]

You might also like