DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Eric Guest

    Exiting an if...then statement in vbscript


    I'm trying to use an if...then statement within a for...next loop to check
    at the outset whether or not a particular value is 0 or not. If it is 0
    (zero), then I want to just exit the if...then statement which will, in theory,
    go right to the 'next' part of the for...next loop and increment the counter.

    Basically, how do I exit an if...then statement like:

    FOR i = 1 TO somenumber
    quantity = request.form("quantity")
    IF quantity = 0 THEN
    'exit the if...then statement
    ELSE
    'execute some code
    END IF
    NEXT





  2. #2
    Douglas J. Steele Guest

    Re: Exiting an if...then statement in vbscript

    Either don't put anything between the IF and THEN, or use:

    FOR i = 1 TO somenumber
    quantity = request.form("quantity")
    IF quantity <> 0 THEN
    'execute some code
    END IF
    NEXT

    --

    Doug Steele, Microsoft Access MVP
    Beer, Wine and Database Programming. What could be better?
    Visit "Doug Steele's Beer and Programming Emporium"
    http://I.Am/DougSteele/


    Eric <ericj@newportinternet.com> wrote in message
    news:390df1b3$1@news.devx.com...
    >
    > I'm trying to use an if...then statement within a for...next loop to check
    > at the outset whether or not a particular value is 0 or not. If it is 0
    > (zero), then I want to just exit the if...then statement which will, in

    theory,
    > go right to the 'next' part of the for...next loop and increment the

    counter.
    >
    > Basically, how do I exit an if...then statement like:
    >
    > FOR i = 1 TO somenumber
    > quantity = request.form("quantity")
    > IF quantity = 0 THEN
    > 'exit the if...then statement
    > ELSE
    > 'execute some code
    > END IF
    > NEXT
    >
    >
    >
    >




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links