It's not a question of being "perliticaly correct". The intention of your code is inherently less readable if you use a
goto. In addition, placing your code in a subroutine
- makes your intentions obvious
- enables you to write tests for the correctness of the code that would be executed twice
- prevents problems that might arise from variables that aren't reset in you looped code