You can display your code in a nice way with the help of three backticks (```) before and after the code. This is also written in the FAQ, which you should read anyway before posting.
I did it for you this time.
Looks good to me.
Here’s a tip from me. Please don’t take it as if you made something wrong. You just happened to trigger my advice-mode, where I give random hints to other people.
If your variablename is composed of multiple words, you can also write it in CamelCase. This is a form of labeling that improves readability even more, and helps you to grab the meaning of a variable in one glance.
yakposx isthexpositionoftheyak
yakPosX is something about the Yak. Ah, the position. Ah, the x.
The uppercase-letters simply help to read the name. The human eye usually does not read the whole text, but only the landmarks of a text. This includes Uppercase letters, unusal fonts (by mixing two fonts), indentations, other text colors (you noticed the hyperlink immediatly, right?) and some more.
Sadly this also applies to code-reading. Just yesterday I checked the code of someone, and didn’t noticed an error, just because I started to scan over it. That was not the fault of the code. But code can be written in a way that makes it more interesting to read, so readers are less likely to fall in scan-mode.