Welcome to the Programming and Software Design Section,
When asking for help with programming issues, please use the code tags to enclose your code, it makes things much more easily readable for the people trying to help you, thus improving your chances of actually getting help.
To add code tags, click the <> button on the editor toolbar, then enter your code in the code editor that appears. If you are on a mobile device, or prefer to use BBCode, you can use
[code] // Your code here // It will be syntax highlighted, though not necessarily corectly. [/code]
(but the code editor is more consistent and less buggy).