Here is a project that combines the do
statement with a
user-defined instruction that uses another user-defined instruction.
The user-defined instruction is one to turn around. It is called by another
user-defined instruction that does one sequence of dance steps described below.
The sequence is repeated (or iterated) four times.
Guido lives in Colorado, where country music is popular. He would like you to teach him how to line dance. Line dancing is a series of steps, up and back, with turns and rotations, with each sequence ending facing in a different direction. If the line dancing pattern is repeated, eventually the dancer will end up at the starting place.
The line dance Guido wants to learn is like this. From the starting position, take two steps forward, turn around, then three steps back. Then three times: turn right, step. This puts Guido back at his starting spot, but facing in a different direction. Repeat this basic step pattern four times to let Guido dance and have some fun.
Copyright © 2003 Roger Frank.