setPos

HC Graphics Absolute Turtle Motion setPos
setXYZ _setPos

setPos pos


Moves the turtle to an absolute X,Y coordinate. The argument is a list of two numbers, the X and Y coordinates. See also Pos.

Example 1 (draw a square):

cs
setpos [0 100]
setpos [100 100]
setpos [100 0]
setpos [0 0]



Example 2 (the most common logo question):

make "x 0
make "y 100

then

setpos [:x :y]

will fail, but

setpos (list :x :y)

will work.

Why?

Because the first case is a list that contains 2 words :x and :y. In the second case a list is BUILT containing the VALUE of :x and :y. You can see this more clearly by using the show command.

show [:x :y]		;[:x :y]
show (list :x :y)		;[0 100]

See also:

Example:

References:

setXYZ _setPos