You are reading a single comment by @Kim and its replies. Click here to read the full conversation.
  • The following code causes an infinite loop and Out of Memory warnings:

      var contents = [1,1,1,2,1,3,2,1,3,1,3,2,4,1,5,1,6,1,6,2­,6,3];
      var i = 0;
      for (i = 0; i < contents.length; i = i + 2) {
        print(contents[i]);
        print(contents[i+1]);
      }
    

    The problem has to do with print(contents[i+1]);so I assume the issue is in the use of i+1at that spot.

    The following modification exposes the same, bad behaviour:

        print(contents[i]);
        j = i + 1;
        print(contents[j]);
    
About

Avatar for Kim @Kim started