Infinite loop

An infinite loop is a programming error in a loop statement that causes it to loop endlessly.

Effects
An infinite loop will cause a program to stop functioning and stop it from closing itself with the close button. It can also take up most of the CPU, making it more difficult to close the program.

If a program is stuck in an infinite loop the only way to close it is with the task manager. The task manager has a higher priority and wont be blocked by the infinite loop.

Prevention
One way to prevent an infinite loop is to have a failsafe variable that ends the loop when it has looped a large amount of times.

var i=1, failsafe=0; do { i += 2; //i was set to 1, so it will reach 9 and skip 10 to get to 11 failsafe+=1; if(failsafe >= 30) {    show_debug_message("do until loop encounted an infinite loop in obj_infiloop"); break; } } until(i == 10)