Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 528 Bytes

File metadata and controls

13 lines (9 loc) · 528 Bytes

Why is loop better than repeating code?

  • Loops reduce code repetition, improve readability, and make programs scalable for large tasks.

What causes an infinite loop?

  • An infinite loop occurs when the loop condition never becomes false.

Difference between break and continue

  • break - exits the loop completely
  • continue - skips current iteration and moves to next

What happens if condition is always true?

  • If the condition is always true, the loop will run forever → infinite loop