Some Machines that Use Cycles
- Bicycle — your legs drive the pedals connected to a gear
- CD Player — the disk spins (cycles) as the laser moves across it.
- TV Set — pictures are put one the screen one after another as long
as the set is on.
- Water Pump — often a piston repeatedly moving in and out of a cylinder.
- Laundry Dryer — rotating drum.
- Clock — shows the same times every day. If the clock is mechanical,
its insides are gears and springs with many mechanical cycles. If the
clock is electronic the cycles are still there, but harder to see.
- Sun and the Earth — endlessly cycling, seasons flowing one into the next.
Perhaps the ultimate example of the usefulness of cycles is the ultimate
Here is a program that uses a loop:
' Example of a loop
PRINT "Type a number"
PRINT "6% of the number is", NUMBER * 0.06
DO statement marks the beginning of several statements that
will be done again and again.
LOOP statement marks the end of those statements.
When this program runs this is what happens:
- The program starts with the
DO statement. The
shows the beginning of the loop.
- The first PRINT statement is executed and prints "Type a number".
- The INPUT statement is executed and gets a number to put in the
- Say that the user typed in 100.
- The second PRINT statement prints "6% of the number is" and then computes
and prints six percent of NUMBER.
- If the NUMBER is 100, the program will print "6% of the number is 6"
LOOP statement marks the end of the loop.
At this point, the statements between
LOOP have each
executed one time.
They are about to execute a second time.
What does the monitor look like at this time?