How can we reuse a loop that iterates through a list?

By nesting it inside a function's code blockWe can't reuse this kind of loop

By nesting it inside a function's code block.