How do you draw rectangle in logo with repeat command?

1 answer

Answer

1012520

2026-05-13 23:05

+ Follow

In Logo, you can draw a rectangle using the REPEAT command to create the four sides efficiently. For example, you can use the following code:

<code class="language-logo">REPEAT 2 [

FORWARD 100 ; length of the rectangle RIGHT 90 FORWARD 50 ; width of the rectangle RIGHT 90 ]

</code>

This code moves the turtle forward to draw the length, turns right, and then draws the width, repeating the process to complete the rectangle.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.