Iteration: Difference between revisions
From Coderwiki
More actions
new |
add recursion section |
||
| Line 6: | Line 6: | ||
* '''Count''' controlled: [[for loop]] | * '''Count''' controlled: [[for loop]] | ||
* '''Condition''' controlled: [[while loop]] | * '''Condition''' controlled: [[while loop]] | ||
== Iteration and recursion == | |||
[[Recursion]] is a programming technique that often achieves the same thing as iteration. In some cases, it can be a better option than iteration. | |||
Revision as of 19:16, 9 August 2025
Iteration is essentially looping.
Loops generally involve repeating some code a certain number of times, or until a condition is met.
Types of iteration
There are two main forms of loops in programming languages:
- Count controlled: for loop
- Condition controlled: while loop
Iteration and recursion
Recursion is a programming technique that often achieves the same thing as iteration. In some cases, it can be a better option than iteration.