If you have more than 100 items, you can look into using recursion, as described in this blog post.
This blog offers a more practical example of recursion in action.