adsense


Showing posts with label VB SCRIPT EXIT DO STATEMENT. Show all posts
Showing posts with label VB SCRIPT EXIT DO STATEMENT. Show all posts

Saturday, 7 November 2015

VB SCRIPT EXIT DO STATEMENT PAGE 20

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button




VB SCRIPT EXIT DO STATEMENT




Exit Do statement 


An Exit Do Statement is used when we want to Exit the Do Loops 
based on certain criteria. It can be used within both Do..While 
and Do..Until Loops. 
When Exit Do is executed, the control jumps to next statement 
immediately after the Do Loop. 
Syntax 
The syntax for Exit Do Statement in VBScript is: 
 Exit Do 

Example 
The following example uses Exit Do. If the value of the 
Counter reaches 10, the Do Loop is Exited and control 
jumps to the next statement immediately after the For Loop. 
<!DOCTYPE html> 
<html> 
<body> 
<script language="vbscript" type="text/vbscript"> 
 
i = 0 
Do While i <= 100 
  If i > 10 Then 
    Exit Do   ' Loop Exits if i>10 
  End If 
  document.write("The Value of i is : " &i) 
  document.write("<br></br>") 
  i = i + 2 
Loop 
       
</script> 
</body> 
</html> 
When the above code is executed, it prints the following output on the console. 
The Value of i is : 0 
 
The Value of i is : 2 
 
The Value of i is : 4 
 
The Value of i is : 6 
 
The Value of i is : 8 
 
The Value of i is : 10