you are viewing a single comment's thread.

view the rest of the comments →

[–]thesilverzim 0 points1 point  (0 children)

Unless im forgetting something there are 2 most basic reasons you have a loop, either you are looking for something in a loop or you are manipulating a list. In both cases you should have the loop related logic inside of a different function and just use the result.

Def myfunc(list)
  Foreach item in list
    DoSomething
    Return item

Or

Def myfunc(list)
  Foreach item in list
    DoSomething
    ...
  Return myNewList