Question

Im trying to Post an unlimited number of likes but looping the cookies and proxies based on the how many cookies are stored in the array. Apparently i++ is unreachable code. What is the reason for that?

public void PostLikes()
{
   PostLike postLike = new PostLike();
   for (int i =0;i<this.cookies.ToArray().Length;i++)
   {
      for (int j = 0; ; j++)
      {
         postLike.PostLike(this.cookies[i], this.importedProxies[i], this.proxyUsernameTextbox, this.proxyPasswordTextbox, this.postsIds[j]);
      }
   }
}
Was it helpful?

Solution 2

And don't do this

for (int i =0;i<this.cookies.ToArray().Length;i++)

because

this.cookies.toArray().Length

its evaluating in every iteration of the for loop, you are making 'this.cookies' to array every time so just you get its length? :) You are increasing the complexity of the method

OTHER TIPS

The real problem is that:

for (int j = 0; ; j++)

Produces an infinite loop, assuming you don't have any other control statements inside (e.g. break, return, goto, throw)

You probably meant to do something like this:

for (int j = 0; j < this.postsIds.Length; j++)
{
    ...
}
for (int j = 0; ; j++)

This is a dead loop, so i++ won't be reached

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top