Jump to content

Loops not working


Recommended Posts

Hi, i've worked with auto it for some time but i'm at a loss for words at the moment

i have a very simple for statement and yet it will not increment, i've tested it extensively

For $x = 1 To 3 Step 1

ConsoleWrite($x)

If StringInStr($title, $Groups[$x],2) <> 0 Then

Return False

Else

Return True

EndIf

Next

the console writes 111111111 meaning it isn't incrementing from 1 to 3. i've tried msg box and a whole bunch of other tests with no luck

let me know if anyone has any ideas

Link to comment
Share on other sites

Whether that condition is true or false, the function will end (Return True/False).

So, the For loop never gets to the second iteration.

The only way for this code to produce repeating 1's is if your function is being called multiple times.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Ahhh I figured it out. I am calling this function multiple times but i wanted it to search through a list of strings to match one and I didn't catch my return false error.

therefore, i moved the return false after the for loop.

Thanks a lot I was mind boggled.

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...