+ Reply to Thread
Results 1 to 2 of 2

Thread: Loops

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    20

    Loops

    I need to know what are the types of Loops and example for each of them ?

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    36
    There are 3 types of loops >> For Loop , While Loop & Do While Loop

    For Loop :
    Code:
    for(x=0;x<10;x++) // that shall print numbers from 1 to 9
    {
    	docume.write(x + "<br />");
    }
    While Loop :
    Code:
    var x = 0;
    
    while(x<10)
    {
    	document.write(x);
    	x++;
    }
    Do While Loop :
    Code:
    var x = 5;
    
    do
    {
    	// code
    }while (x < 10);

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts