It seems to work just fine when I ran it.1-499 displayed on the screen. if you move the set command to after the if statement it will count to 500. It looks like you are asking a question, but i am failing to see what is needed.
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this
site. Computing.Net and Purch hereby disclaim all responsibility
and liability for the content of Computing.Net and its accuracy.