Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to goto... break?

Status
Not open for further replies.

cyprus106

Programmer
Apr 30, 2001
654
0
0
I'm relatively new to ASP, and while coding, I was using a series of if...then statements and came across the need to stop reading the asp code. for example:

if Request("StopMe") = "true" then
;stop reading asp
else
do whatever functions you need to do
end if

I need to break out of a loop or stop reading the code entirely. I need something equivilent to C's 'return' and it's 'goto' functions. Is this a possibility?

Thanks! Cyprus
 
cyprus106:

There is no such thing as goto in asp. But if you want to end a process completely, you can use Response.End(). Keep in mind that this will cease processing meaning that any code below this line will not be read or displayed.

I hope this helps,
[yinyang]
Patrick
 
Use response.end
that should do it..
to call a sub at some point you could just dom this.
call subName

so, it could look like this

If 50 > 20 then
'uh on... lots here... want to get out...
call subName 'if you want this, do something here
response.end 'finaly, ending the process
else
'blah blah blah
end if

hope that helps
 
either suggestions are good. you can also structure your code to call functions or subs to act as the goto does
eg
if Request("StopMe") = "true" then
loadHTML
else
do whatever functions you need to do
end if

function loadHTML
response.write "your html code here"
or something to taht effect
end function
_________________________________________________________
for the best results to your questions: FAQ333-2924
[sub]01001111 01101110 01110000 01101110 01110100[/sub]
onpnt2.gif
[sup] [/sub]
 
alright, that did it. thanks a lot. Cyprus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top