Common Mistakes

This lesson discusses some of the common mistakes that programmers make while using loops in their code.

Infinite while loop

The main risk with while loops is producing an infinite loop, meaning the condition is always true, and the code runs forever. This will crash your program! For example, let’s say you forget a code line that increments the number variable.

Get hands-on with 1200+ tech skills courses.