GlossaryFundamentals
What is a loop?
A loop is a coding structure that repeats a block of code multiple times.
A loop allows you to run a specific set of instructions repeatedly without having to write the same code multiple times. This is useful for tasks that require repetition, like processing items in a list.
For example, if you have a list of names and want to print each name, a loop can do this efficiently. Instead of writing a print statement for each name, you can use a loop to go through the list and print each one automatically.
Example
for name in names: print(name)
Related terms
Want to use Loop in real work?
WeCode workshops are built around AI coding tools. Pick a tier, or browse more glossary entries to get the lay of the land.
