Skip to main content
Engineering LibreTexts

15: Loops

  • Page ID
    15255
  • Computers are often used to automate repetitive tasks. Repeating tasks without making errors is something that computers do well and people do poorly.

    Running the same code multiple times is called iteration. We have seen methods, like countdown and factorial, that use recursion to iterate. Although recursion is elegant and powerful, it takes some getting used to. Java provides language features that make iteration much easier: the while and for statements.

    • Was this article helpful?