Uploaded by marzia malhotra

LOGO Programming procedures

advertisement
The Westminster School, Dubai
Year 6 - LOGO Programming - Creating Procedures
Creating shapes in LOGO using Repeat commands
Commands for basic 2-D shapes
Square
Repeat 4 [fd 200 rt 90]
Rectangle
Fd 300 rt 90 fd 150 rt 90
Fd 300 rt 90 fd 150 rt 90
Circle
Repeat 360 [fd 3 rt 1]
Triangle
Repeat 3 [fd 300 rt 120]
Pentagon
Repeat 5 [fd 200 rt 72]
Hexagon
Repeat 6 [fd 200 rt 60
Octagon
Repeat 8 [fd 150 rt 45]
Nonagon
Repeat 9 [fd 150 rt 40]
Decagon
Repeat 10 [fd 100 rt 36]
To create a procedure for square the syntax is
To square repeat 4[fd 100 rt 90] end
Repeated pattern created using a square:


Repeat 10 [square rt 36]
Repeat 12 [square rt 30]
The Westminster School, Dubai


Repeat 30 [square rt 12]
Repeat 36 [square rt 10]
To create a procedure for square pattern the syntax is

To squarepattern Repeat 30 [square rt 360/30] end or To squarepattern
Repeat 30 [square rt 12]
To create a procedure for hexagon the syntax is
To hexagon repeat 4[fd 100 rt 90] end
Repeated pattern created using a hexagon:




Repeat 10 [hexagon rt 36]
Repeat 12 [hexagon rt 30]
Repeat 30 [hexagon rt 12]
Repeat 36 [hexagon rt 10]
To create a procedure for hexagon pattern the syntax is

To hexagonpattern Repeat 12 [hexagon rt 360/12] end or To
hexagonpattern Repeat 30 [square rt 12]
To change the colour of the pen the syntax is
Setcolor “red
or
setcolor 5
To change the width of the pen
Setwidth 5 (The number decides the thickness of the pen.)
Download