Apr 25, 2024
In your next example, the first code (using a loop) stops as soon it finds a match. But the second code (using next) always processes the entire loop before it returns the first match.
That isn't necessarily a bad thing, but it could be a problem if the list is very large.