DECLARE EXTERNAL SUB turtle.fd, turtle.rt
SET WINDOW -2,2,-2,2
FOR i=1 TO 30
   CALL fd(1)
   CALL rt(135)
NEXT i
END
! LOGO-like turtle graphics
MODULE turtle
MODULE OPTION ANGLE DEGREES
PUBLIC SUB fd, rt
SHARE NUMERIC curX, curY, direction
LET curX=0
LET curY=0
LET direction=90
EXTERNAL SUB fd(r)  ! Forward 
   LET curX=curX+r*COS(direction)
   LET curY=curY+r*SIN(direction)
   PLOT LINES: curX, curY;
END SUB
EXTERNAL SUB rt(t)  ! Right Turn 
   LET direction=direction - t
END SUB
END MODULE
