Could you please edit your post to make it a bit easier to read (and therefore easier to help you)? If you format your code with backticks then it will render properly, and if you can add the actual error message or incorrect result you’re getting, then we’ll be able to more easily figure out what’s wrong and how to fix it.
Edit: sorry for the double-post. I’m just echoing what @odow said.