Silver Library (Archived)
Iteration vs loop, aren't they the same? 본문
Iteration vs loop, aren't they the same?
Ayin Kim 2023. 1. 17. 22:21Looks like I made a wrong assumption. Loop and iteration are not the same but sharing some common point.
What are they?
A for loop is a type of loop in programming that allows you to iterate over a sequence of elements, such as a list or an array. It typically includes a loop variable, which is used to keep track of the current element in the sequence, and a loop body, which contains the code that is executed for each element.
Iteration, on the other hand, is the process of repeatedly executing a certain block of code. It is a general concept that can be achieved using different types of loops, such as for loops or while loops.
In summary,
- for loop is a type of loop that is used to iterate over a sequence of elements
- while iteration is a general concept that refers to repeatedly executing a block of code.
'F2. Problem & Solving > Theory of algorithm' 카테고리의 다른 글
Difference between Hash vs Node memory (0) | 2023.04.25 |
---|---|
#4 Insertion Sort (0) | 2023.01.10 |
#3 Selection, Sorting algorithm (0) | 2023.01.10 |
#2 Algorithm, 4 steps and way to describe it. (0) | 2023.01.08 |
#1 Start - Fundamental of algorithm (0) | 2023.01.07 |