Difference between iteration and loop

Hi! I’ve been searching but I think I still don’t understand the difference between this concepts. I’m learning while and for loops from Javascript Curriculum.

Hi, could you expand a bit more on what you mean by ‘iteration’?

By “iteration” I understand the repetition of a certain procedure. In the challenges it is described that for and while are types of “loops”. Are they a type of iteration too?

I’m not sure that I understand the distinction. Loops iterate over a specified range of values.

A loop by definition is achieving an iteration. Often we talk about iterative solutions, as opposed to recursive ones - using a loop of for iteration rather than recursion.

Jeremy points out, iteration means iterating over values, which is kind of what a for loop is designed for. You can use a while or do/while loop to iterate over values too, but you could also use them for non iterative things, like pinging a service until it succeeds.

3 Likes