Microsoft Small Basic

Program Listing: CZJ500
'Show the tortoise --#1
Tortoise.Show()
'Make the tortoise move as fast as possible --#8
Tortoise.SetSpeed(10)
'Do the following 4 times --#9
For j = 1 To 4
' DrawSquare (recipe below) --#7
DrawSquare()
' Turn the tortoise 90 degrees to the right --#10
Tortoise.TurnRight()
'Repeat --#9
EndFor


'------------- Recipe for DrawSquare --#6
Sub DrawSquare
' Do the following 4 times --#5
For i = 1 To 4
' Change the color of the line the tortoise draws to a random color --#3
Tortoise.SetPenColor(Colors.GetRandomColor())
' Move the tortoise 50 pixels --#2
Tortoise.Move(50)
' Turn the tortoise 90 degrees to the right --#4
Tortoise.TurnRight()
' Repeat --#5
EndFor
'------------- End of DrawSquare recipe --#6
EndSub