Arash Ehsanfar wrote:he did point out the problem, however, he did not suggest how i could solve it.
he didn't? Then what is this?
Jesper de Jong wrote:Put line 17 outside the loop - before line 9.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors