Learn English – Difference between words ‘cycle’ and ‘loop’

difference

What’s the difference between words cycle and loop in English? Why do we use loop in a programming and when do we use cycle?

Best Answer

Let me share my intuition. (I'm not going to quote any definitions in dictionaries in this answer. Also keep in mind that I'm a non-native speaker.)

Here is probably one of the best ways to think of the subtle differences between cycle and loop.

Imagine a "circle".

You have a circle in your mind now, right? Okay, that is a "loop".
A loop is basically a circle, or a round path. If you have a string and you tie the two ends together, you get a "loop". One important property of a loop is that it has no beginning and it has no end.

What about "cycle"? If you drag your finger along a circle, you will complete one "cycle" when your finger is back at the point where you started your dragging.

See, "loop" is a thing, a path that its end is its beginning and its beginning is its end;
while "cycle" is rather activity-like, like when we go along such a path or make/complete a cycle.

And because we can informally say either "my code loops through this loop" or "my code cycles through this loop", the real uses of the two words are kind of blended together. (You may want to use something else, such as "iterate", in formal writing.) Unsurprisingly, the two are interchangeable in some contexts, though most of the time, you wouldn't really want to use one in the place of another.


In programming, you'd want to write a loop, not a cycle, in your code ('cause a loop is a thing, while a cycle is an activity.) How many loops your code will run a loop would depend on the conditions in your code. When it runs, you may call "each time your code completes a loop" either a "loop" or a "cycle"; and you may want to call "each time your code completes its execution" either a "run" or a "cycle".

For example, let's say you're developing a game, and you've got a function named PrepareSkynet().
Let's assume that you write a for loop in your PrepareSkynet() to make 42 terminators.
You may say that your PrepareSkynet() runs the "make a terminator" for-loop 42 times.
You could also say that it does 42 "make a terminator" for-loops.
Or it loops the "make a terminator" for-loop 42 times.
You may as well say that your "make a terminator" for-loop runs 42 times, or 42 cycles.

See? It's rather flexible!

Hope you'll get the hang of it soon!