Jump to content

for...next loop


Recommended Posts

@rednaxela

You should use UBound() with your array in order to avoid to write 5 in your For...Next loop, and then, if you want to skip an element in your loop, just use an If...Then with the index ($x), and if the condition is true, use ContinueLoop.

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

5 hours ago, FrancescoDiMuro said:

@rednaxela

You should use UBound() with your array in order to avoid to write 5 in your For...Next loop, and then, if you want to skip an element in your loop, just use an If...Then with the index ($x), and if the condition is true, use ContinueLoop.

; Display all the numbers for 1 to 10 but skip displaying  7.
For $i = 1 To 10
    If $i = 7 Then
        ContinueLoop ; Skip displaying the message box when $i is equal to 7.
    EndIf
    MsgBox($MB_SYSTEMMODAL, "", "The value of $i is: " & $i)
Next

this is what i was looking for :3

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...