Choose how many times you want to loop

deleted post

If you want to loop something x times then use for loop

for (int x = 2; x < 100; x = x * 1.5) {
  println(x);
}

maker-20_:
If you want to loop something x times then use for loop

for (int x = 2; x < 100; x = x * 1.5) {

println(x);
}

Did you not read the post? I know how to loop something, i just want the user to be able to input into the serial how many iterations they want.

He gave you a clue about how to loop correctly. Yours will not loop at all unless userInput is negative, in which case it will loop forever...

jacklythgoee:
Did you not read the post? I know how to loop something, i just want the user to be able to input into the serial how many iterations they want.

https://startingelectronics.org/software/arduino/learn-to-program-course/19-serial-input/