Jun 18 2008 1:14PM GMT
Posted by: Jerry Lees
exit, VBScript, VBScript Statements, vbscriptstatements
VBScript Statements: Explanation of the Exit statement
Posted by: Jerry Lees
The Exit statement in vbscript allows you to exit a block of code, in the case of a subroutine (Exit Sub) or a function (Exit Function), or the entire script.
This statement is assumed at the end of a script, and therefore is not required, but is typically used in conditional statements to exit a section of code when a particular condition is met.
Below is an example:
mysub(1)
mysub(3)
mysub(2)
mysub(0)
sub mysub(testvar)
testvar=testvar + 1
if testvar =2 then
exit sub
else
wscript.echo testvar
endif
end sub




