Javascript - break

Results 1 to 4 of 4

Thread: Javascript - break

  1. #1
    Join Date
    Dec 1969

    Default Javascript - break

    If i am using ASP to write a control statement, how do i control the looping like what we did in java or javascript which use the break? Does ASP have this 'break' statement?

  2. #2
    KPW Guest

    Default ASP is not the opposite of JavaScript!

    First off, let me point out that ASP is not the opposite of JavaScript. When you say that you are "using ASP to write a control statement," you could be using VBScript, JavaScript, PerlScript, or some other ActiveX scripting language. I think what you really mean is that you are using VBScript to write a control statement.<BR><BR>What control statement are you using? A Do loop? While...Wend?<BR><BR>VBScript has various Exit statements which should work to break out of a loop. For example:<BR><BR>Do<BR>If x &#062; 5 Then<BR>Exit Do<BR>End If<BR>x = x + 1<BR>Loop<BR><BR>(Okay, so normally you would probably write "Do While x &#060;= 5" but this is just for demonstration!)<BR><BR>HTH

  3. #3
    Join Date
    Dec 1969

    Default RE: Javascript - break

    do until x&#060;=100<BR>if x=50 then<BR>exit do<BR>end if<BR>loop<BR><BR>similarly <BR><BR>for..<BR>exit for<BR>next

  4. #4
    wex_69 Guest

    Default RE: Javascript - break

    Try the Exit Do is somewhat akin to the break statement in JavaScript.<BR><BR>The Exit Do can only be used within a Do...Loop control structure to provide an alternate way to exit a Do...Loop. Any number of Exit Do statements may be placed anywhere in the Do...Loop. Often used with the evaluation of some condition (for example, If...Then), Exit Do transfers control to the statement immediately following the Loop. I got that from the VB Script reference documentation. I think I may have told you about this file already Joe? Any questions you have my number : )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts