clearscreen
forward 40
right 90
forward 40
right 90
forward 40
right 90
forward 40
right 90

clearscreen
repeat 4 [forward 40
right 90
]

clearscreen
to square :length
repeat 4 [forward :length
right 90
]
end

square 40
square 50
square 70
square 100
square 140

clearscreen
to triangle :length
repeat 3 [forward :length
right 120
]
triangle 60
end

clearscreen
to pentagon :length
repeat 5 [forward :length
right 72
]
end
pentagon 60

clearscreen
to octagon :length
repeat 8 [forward :length
right 45
]
end

octagon 60

clearscreen
forward 50
right 135
forward 50

theta = 180 - ( ( ( n - 2 ) *180 ) /n )

clearscreen
to polygon :length :side :theta
repeat :side [forward :length
right :theta
]
end

pendown
polygon 60 3 120
penup forward 100
pendown
polygon 60 8 45

Logo 實際上是可以作簡單的數學計算，例如以下的 procedure

to squaring :n
output :n * :n
end

print squaring 4

print squaring squaring squaring 4

print squaring squaring 16

Sharon 計算 squaring 16 ，結果是 256 ，再交給 Sara ，指令變成

print squaring 256

Sara 計算 squaring 256 ，得出結果 65536 ，再交給 peter 。 Peter 把這個數字打出來。

to polygon :length :side
repeat :side [forward :length
right calculatetheta :side
]
end

to calculatetheta :side
output 180 - ( ( ( :side-2 ) * 180 )/ :side )
end

polygon 20 3
polygon 20 4
polygon 20 9
polygon 20 21

polygon 20 2

1. :side < 3 為真就[停止]
2. :side < 3 為假就[畫圖]

to polygon :length :side
ifelse :side <3 [stop]
[repeat :side [forward :length
right calculatetheta :side
]]
end