A programmer can accidentally create an infinite loop by not realising that the values the program uses cause the loop's condition to never be met. Infinite loops can be created using either while or repeat loops.