web 2.0

ASP/VBScript Exit Keyword

ASP/VBScript Exit Keyword Exits a block of Do…Loop, For…Next, Function, or Sub code.

ShotDev Focus:
- Using Asp and Exit Keyword

Syntax


Exit Do

Exit For

Exit Function

Exit Property

Exit Sub

The Exit statement syntax has these forms:

Statement Description
Exit Do Provides a way to exit a Do…Loop statement. It can be used only inside a Do…Loop statement. Exit Do transfers control to the statement following the Loop statement. When used within nested Do…Loop statements, Exit Do transfers control to the loop that is one nested level above the loop where it occurs.
Exit For Provides a way to exit a For loop. It can be used only in a For…Next or For Each…Next loop. Exit For transfers control to the statement following the Next statement. When used within nested For loops, Exit For transfers control to the loop that is one nested level above the loop where it occurs.
Exit Function Immediately exits the Function procedure in which it appears. Execution continues with the statement following the statement that called the Function.
Exit Property Immediately exits the Property procedure in which it appears. Execution continues with the statement following the statement that called the Property procedure.
Exit Sub Immediately exits the Sub procedure in which it appears. Execution continues with the statement following the statement that called the Sub.

Example

asp_exit_keyword.asp


<% Option Explicit %>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<%
Dim i
i = 0
Do
i = i + 1
Response.write("www.ShotDev.Com<br>")
If i = 3 Then
Exit Do
End IF
Loop While i <= 5
%>
</body>
</html>

Create a asp file and save to path root-path/myasp/

Run
http://localhost/myasp/asp_exit_keyword.asp

Screenshot

ASP/VBScript & Exit Keyword

.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.