A good answer might be:

Some Machines that Use Cycles

Perhaps the ultimate example of the usefulness of cycles is the ultimate machine — the wheel.


The while statement

Here is a program with a loop:

import java.io.*;
// Example of a while loop
class loopExample
{
  public static void main (String[] args ) 
  {
    int count = 1;                                  // start count out at one
    while ( count <= 3 )                            // loop while count is <= 3
    {
      System.out.println( "count is:" + count );
      count = count + 1;                            // add one to count
    }
    System.out.println( "Done with the loop" );
  }
}

The statement count = count + 1 increases the value stored in the variable count by adding one to it. You would learn a lot if you imported this program into NotePad and ran it in the DOS window. Or, you can run a JavaScript version of the program by clicking the button:




If you look at the source for this page using your browser's "View Source" menu item, you will see the JavaScript that is responsible for the above. JavaScript is similar to Java, but has some big differences, so be careful not to get confused.

QUESTION 2:

What does this statement do:

count = count + 1;