Just to mention that, instead of creating multiple names (variables) like pos0, pos1, pos2... it may be better to use some sort of collection. It depends on what you want to do with pos0, pos1, pos2...
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs