Jump to content
Sign in to follow this  

Break from loop?

Recommended Posts


I have a for loop like this:

For $i = 1 To $rows Step 1
    Case $run[$i] = 0
           ;Break from the For loop
    Case $run[$i] = Y
                      ;Do something
                Case $run[$i] = Z
                      ;Do something

When I hit $run[$i] = 0, I want to break from the For loop. I'm doing this because I'm reading in an array and doing actions based on the array values. But, if this first value is 0, I don't want to sort through it at all. I know I can do this other ways, but it would be so much easier if I could break, otherwise some serious re-writing will have to occur...

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.