/*
    A very simple example of using a for-loop.

    The last loop shows how a while-loop can be written
    that is (almost) equivalent to the for-loop. It is always
    true that a for-loop can be converted into an "equivalent"
    while-loop (there is just one small difference between the
    for-loop and its "equivalent" while loop).
*/
import java.util.Scanner;

public class ForLoop
{
    public static void main(String[] args)
    {
        Scanner keyboard = new Scanner(System.in);

        System.out.print("Enter a number: ");
        int number = keyboard.nextInt( );

        for (int count = 1; count <= number; count++)
        {
            System.out.print(count + ", ");
        }
        System.out.println("\nBuckle my shoe.");


        System.out.println("\nDo it again.\n");


        for (int count = 0; count < number; count++)
        {
            System.out.print(count + 1 + ", ");  // Consider the two + signs.
        }                                        // What does each one mean?
        System.out.println("\nBuckle my shoe.");


        System.out.println("\nDo it once again.\n");


        int count = 0;
        while( count < number )
        {
           System.out.print(count + 1 + ", ");
           count++;
        }
        System.out.println("\nBuckle my shoe.");
    }//main()
}
