Friday 10, February 2012
Welcome Guest, Register | Login  
      Home    |    Tutorials    |    Free Ebooks    |    Free Scripts    |    Articles    |    Blog     |    Forum    |    About Us    |    Contact Us

While Loop

While Loop
The VBScript While Loop executes code while a condition is true.
Example

  Dim numb
  numb = 0
  While numb <= 8

    document.write("Number Is: " & numb & vbCRLF )

numb = numb + 1
  Wend
    document.write("End of While!")

This results is:
Number Is: 0
Number Is: 1
Number Is: 2
Number Is: 3
Number Is: 4
Number Is: 5
Number Is: 6
Number Is: 7
Number Is: 8
End of While!

  1. We started by declaring a variable called "numb" and setting it to 0
  2. We then opened a while loop and inserted our condition. Our condition checks if the current value of the numb variable is less than or equal to 8.
  3. This is followed by code to execute while the condition is true. In this case, we are simply, outputting the current value of numb, preceded by some text.
  4. We then increment the value by 1.
  5. When the browser reaches the closing curly brace, if the condition is still true, it goes back to the first curly brace and executes the code again. By now, the numb variable has been incremented by 1. If the condition is not true (i.e. the variable is greater than 8), it exits from the loop, and continues on with the rest of the code.
 
     
   
VBScript Tutorial
 
  Introduction
Introduction
  How to
How to
  Where to
Where to
  Working With Variables
Working With Variables
  Arrays
Arrays
  VBScript Procedures
VBScript Procedures
  Conditional Statements
Conditional Statements
  For Next Loop
For Next Loop
  While Loop
While Loop
  Comments
Comments
  Date
Date
  MsgBox
MsgBox
 
 
 
Web Designing Tutorials
  HTML Tutorial
HTML Tutorial
  DHTML Tutorial
DHTML  Tutorial
  CSS Tutorial
CSS Tutorial
  XHTML Tutorial
XHTML Tutorial
 
Programming Languages Tutorials
  C Language Tutorial
C Language Tutorial
  C++ Tutorial
C++ Tutorial
  Java Language Tutorial
Java Language Tutorial
  Data Structure Theory Tutorial
Data Structure Theory Tutorial
 
Server Side Scripting Tutorials
  PHP Tutorial
PHP Tutorial
  SQL Tutorial
SQL Tutorial
  ASP Tutorial
ASP Tutorial
 
Client Side Scripting Tutorials
  JavaScript Tutorial
JavaScript Tutorial
  VBScript Tutorial
VBScript Tutorial
 
 
 
POPULAR E-BOOKS
 
Download Marketing Your Music  First Steps Ebook Marketing Your Music First Steps
   
Download Introduction to Programming (in Java) - An Interdisciplinary Approach  Ebook Introduction to Programming (in Java) - An Interdisciplinary Approach
   
Download The Art of Computer Game Design  Ebook The Art of Computer Game Design
   
Download PHP 5 Power Programming  Ebook PHP 5 Power Programming
   
Download SQL Server 2000 High Availability  Ebook SQL Server 2000 High Availability
   
 
Studiesinn.com © 2012 All Rights Reserved.
Website Designed & Developed by TechXprtz