Meaning & use
loop over
Last updated
Meaning
phrasephrasal verbcomputing
To go through each item in a list or collection one after another in a program, performing the same steps on each.
Grammar: Takes an object after over: loop over the list.
Patterns
- loop over something
- loop over something and do something
You can loop over every name in the list and print it.
The script will loop over all the files in the folder.
I need to loop over the rows of the table and add up the totals.
Word forms
| third person singular | loops over |
|---|---|
| past tense | looped over |
| past participle | looped over |
| -ing form | looping over |
Common combinations
- loop over a list
- Loop over a list of numbers and square each one.
- loop over the elements
- The function will loop over the elements of the array.
- loop over each item
- Loop over each item and check whether it is empty.
- loop over the keys
- We loop over the keys of the dictionary to find the match.
- loop over all files
- The program will loop over all files in the directory.
Synonyms and how they differ
- iterate over
- Iterate over is the more formal term for the same action, while loop over is the casual spoken version.
- traverse
- Traverse suggests moving through a structure such as a tree, whereas loop over fits flat lists.
- cycle through
- Cycle through can mean going round again and again, while loop over usually has an end.
Word family
Commonly confused: loop over or loop in?
loop over vs loop in
To loop someone in means to include them in a conversation or email. It has nothing to do with going through items in code.
Practice
Which sentence uses the phrasal verb correctly in a programming context?
Choose one answer.
Loop over is the usual phrase for visiting every item. Loop in means to include a person, and the other prepositions are not used this way.
Make it your own
Write a sentence using “loop over”, then check it and compare it with the examples above.