|
|
|
< system variables |
Walk Commands |
turn commands > |
|
|
The 'walk' commands all tell the turtle to walk forwards, and optionally do something when you get there. The four options are:
These commands can be used alone, in which case the turtle moves the walk-distance held in $;. For example this program... | ...draws a line of length 1 unit, because the default value of $; is 1. The basic commands can also be combined with other characters to change the distance moved. Each combination forms a single Tymless keyword:
Example 1. |*2 ; |+=2 ;:4 | This program draws three lines with space between them.
Example 2. |: (3 by 4) This program draws a line directly from the origin (0,0) to location (3,4), and then another one from there to (2,1). There are also three related commands:
The regular polygon command {} deserves some explanation. It does not cause the Turtle to move or change direction, but nevertheless draws a polygon with ${} sides. The direction the turtle is facing passes through the middle of one side. The size of the polygon (i.e. its diameter, the distance between the centres of two adjacent polygons) is given by $;. The regular polygon command {} can be combined with the same characters as draw | etc, to give more control of the polygon size. Example 3. (3 by 5) <-> (2 by 4) ...draws a line from (3,5) to (2,4). Example 4. ${} = 6 ...draws two concentric hexagons
|
|
< system variables |
turn commands > |