Well, maybe. But the code you wrote seems simple enough, although perhaps with some syntax errors... I don't see a main program loop, and the curly brackets "{ ... }" do not appear to be paired correctly... a left curly bracket is missing. And the whole code snippet appears to be a subroutine...