For loop driven by event crashes

  let lt = input1.value();
  let st = input2.value(); 
  let tt = input3.value(); // why does this infinite loop?
  for (let i = st; i < lt; i = i + tt) {
    ellipse((30 * i), (30 * i), 40, 40);
    text(i, (30 * i), (30 * i)+5)

Make sure you lt and st around the right way. The code shown in the sketch does not match what you’ve posted here.

Thanks TfGuy44, but I am pretty sure the variables are being used correctly. I even colorized the text in each input box to be sure. In fact, if I comment out the portion of the code where I use var tt, it works as expected. Somehow the issue involves tt, not st or lt.

Still confused by what is happening.


The values from the input boxes are not automatically interpreted as numbers. Try this:

  let lt = Number(input1.value());
  let st = Number(input2.value()); 
  let tt = Number(input3.value());

Thank you, Rick. The lack of variable typing has always confounded me a bit with JavaScript. That was the trick!