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]);
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
The following code causes an infinite loop and Out of Memory warnings:
The problem has to do with
print(contents[i+1]);
so I assume the issue is in the use ofi+1
at that spot.The following modification exposes the same, bad behaviour: