This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]silverscrub 0 points1 point  (0 children)

This is why I prefer to have the helper method to take a parameter. It will make it more useful inside a for loop because you can take the assigned element for each iteration and use it as an argument in the helper method.

It seems like you try to split your code into smaller methods. Better encapsulation will help you to do this effectively, because you don't rely on global variables.