A good answer might be:
Some Machines that Use Cycles
| |
The |
import java.io.*;
// Exampe 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" );
}
}
|
count = count + 1; increases the
value stored in the variable count by adding one to it.
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.
What does this statement do:
count = count + 1;
Click Here after you have answered the question